Removing unneeded AUD_ResampleFactory.
intern/AUD_ReadDevice.h
intern/AUD_Reference.h
intern/AUD_ReferenceHandler.cpp
- intern/AUD_ResampleFactory.h
intern/AUD_ResampleReader.cpp
intern/AUD_ResampleReader.h
intern/AUD_SequencerFactory.cpp
specs.rate *= m_pitch;
return specs;
}
+
+float AUD_PitchReader::getPitch() const
+{
+ return m_pitch;
+}
+
+void AUD_PitchReader::setPitch(float pitch)
+{
+ m_pitch = pitch;
+}
/**
* The pitch level.
*/
- const float m_pitch;
+ float m_pitch;
// hide copy constructor and operator=
AUD_PitchReader(const AUD_PitchReader&);
AUD_PitchReader(AUD_Reference<AUD_IReader> reader, float pitch);
virtual AUD_Specs getSpecs() const;
+
+ float getPitch() const;
+ void setPitch(float pitch);
};
#endif //AUD_PITCHREADER
AUD_SRCResampleFactory::AUD_SRCResampleFactory(AUD_Reference<AUD_IFactory> factory,
AUD_DeviceSpecs specs) :
- AUD_ResampleFactory(factory, specs)
+ AUD_MixerFactory(factory, specs)
{
}
#ifndef AUD_SRCRESAMPLEFACTORY
#define AUD_SRCRESAMPLEFACTORY
-#include "AUD_ResampleFactory.h"
+#include "AUD_MixerFactory.h"
/**
* This factory creates a resampling reader that uses libsamplerate for
* resampling.
*/
-class AUD_SRCResampleFactory : public AUD_ResampleFactory
+class AUD_SRCResampleFactory : public AUD_MixerFactory
{
private:
// hide copy constructor and operator=
AUD_LinearResampleFactory::AUD_LinearResampleFactory(AUD_Reference<AUD_IFactory> factory,
AUD_DeviceSpecs specs) :
- AUD_ResampleFactory(factory, specs)
+ AUD_MixerFactory(factory, specs)
{
}
#ifndef AUD_LINEARRESAMPLEFACTORY
#define AUD_LINEARRESAMPLEFACTORY
-#include "AUD_ResampleFactory.h"
+#include "AUD_MixerFactory.h"
/**
* This factory creates a resampling reader that does simple linear resampling.
*/
-class AUD_LinearResampleFactory : public AUD_ResampleFactory
+class AUD_LinearResampleFactory : public AUD_MixerFactory
{
private:
// hide copy constructor and operator=
+++ /dev/null
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * Copyright 2009-2011 Jörg Hermann Müller
- *
- * This file is part of AudaSpace.
- *
- * Audaspace is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * AudaSpace is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Audaspace; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file audaspace/intern/AUD_ResampleFactory.h
- * \ingroup audaspaceintern
- */
-
-
-#ifndef AUD_RESAMPLEFACTORY
-#define AUD_RESAMPLEFACTORY
-
-#include "AUD_MixerFactory.h"
-
-typedef AUD_MixerFactory AUD_ResampleFactory;
-
-#endif //AUD_RESAMPLEFACTORY
typedef std::list<AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> >::iterator AUD_HandleIterator;
-AUD_SoftwareDevice::AUD_SoftwareHandle::AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, bool keep) :
- m_reader(reader), m_keep(keep), m_volume(1.0f), m_loopcount(0),
+AUD_SoftwareDevice::AUD_SoftwareHandle::AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_PitchReader> pitch, bool keep) :
+ m_reader(reader), m_pitch(pitch), m_keep(keep), m_volume(1.0f), m_loopcount(0),
m_stop(NULL), m_stop_data(NULL), m_status(AUD_STATUS_PLAYING), m_device(device)
{
}
float AUD_SoftwareDevice::AUD_SoftwareHandle::getPitch()
{
- return std::numeric_limits<float>::quiet_NaN();
+ return m_pitch->getPitch();
}
bool AUD_SoftwareDevice::AUD_SoftwareHandle::setPitch(float pitch)
{
- return false;
+ m_pitch->setPitch(pitch);
+ return true;
}
int AUD_SoftwareDevice::AUD_SoftwareHandle::getLoopCount()
AUD_Reference<AUD_IHandle> AUD_SoftwareDevice::play(AUD_Reference<AUD_IReader> reader, bool keep)
{
// prepare the reader
+ // pitch
+
+ AUD_Reference<AUD_PitchReader> pitch = new AUD_PitchReader(reader, 1);
+ reader = AUD_Reference<AUD_IReader>(pitch);
+
// resample
#ifdef WITH_SAMPLERATE
reader = new AUD_SRCResampleReader(reader, m_specs.specs);
return NULL;
// play sound
- AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound = new AUD_SoftwareDevice::AUD_SoftwareHandle(this, reader, keep);
+ AUD_Reference<AUD_SoftwareDevice::AUD_SoftwareHandle> sound = new AUD_SoftwareDevice::AUD_SoftwareHandle(this, reader, pitch, keep);
lock();
m_playingSounds.push_back(sound);
#include "AUD_IHandle.h"
#include "AUD_Mixer.h"
#include "AUD_Buffer.h"
+#include "AUD_PitchReader.h"
#include <list>
#include <pthread.h>
/// The reader source.
AUD_Reference<AUD_IReader> m_reader;
+ /// The pitch reader in between.
+ AUD_Reference<AUD_PitchReader> m_pitch;
+
/// Whether to keep the source if end of it is reached.
bool m_keep;
public:
- AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, bool keep);
+ AUD_SoftwareHandle(AUD_SoftwareDevice* device, AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_PitchReader> pitch, bool keep);
virtual ~AUD_SoftwareHandle() {}
virtual bool pause();