3D Audio GSoC:
Removing unneeded AUD_ResampleFactory.
This commit is contained in:
@@ -105,7 +105,6 @@ set(SRC
|
||||
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
|
||||
|
@@ -42,3 +42,13 @@ AUD_Specs AUD_PitchReader::getSpecs() const
|
||||
specs.rate *= m_pitch;
|
||||
return specs;
|
||||
}
|
||||
|
||||
float AUD_PitchReader::getPitch() const
|
||||
{
|
||||
return m_pitch;
|
||||
}
|
||||
|
||||
void AUD_PitchReader::setPitch(float pitch)
|
||||
{
|
||||
m_pitch = pitch;
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ private:
|
||||
/**
|
||||
* The pitch level.
|
||||
*/
|
||||
const float m_pitch;
|
||||
float m_pitch;
|
||||
|
||||
// hide copy constructor and operator=
|
||||
AUD_PitchReader(const AUD_PitchReader&);
|
||||
@@ -58,6 +58,9 @@ public:
|
||||
AUD_PitchReader(AUD_Reference<AUD_IReader> reader, float pitch);
|
||||
|
||||
virtual AUD_Specs getSpecs() const;
|
||||
|
||||
float getPitch() const;
|
||||
void setPitch(float pitch);
|
||||
};
|
||||
|
||||
#endif //AUD_PITCHREADER
|
||||
|
@@ -34,7 +34,7 @@
|
||||
|
||||
AUD_SRCResampleFactory::AUD_SRCResampleFactory(AUD_Reference<AUD_IFactory> factory,
|
||||
AUD_DeviceSpecs specs) :
|
||||
AUD_ResampleFactory(factory, specs)
|
||||
AUD_MixerFactory(factory, specs)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -32,13 +32,13 @@
|
||||
#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=
|
||||
|
@@ -34,7 +34,7 @@
|
||||
|
||||
AUD_LinearResampleFactory::AUD_LinearResampleFactory(AUD_Reference<AUD_IFactory> factory,
|
||||
AUD_DeviceSpecs specs) :
|
||||
AUD_ResampleFactory(factory, specs)
|
||||
AUD_MixerFactory(factory, specs)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -32,12 +32,12 @@
|
||||
#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=
|
||||
|
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* $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
|
@@ -45,8 +45,8 @@
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
@@ -192,12 +192,13 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::setVolume(float volume)
|
||||
|
||||
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()
|
||||
@@ -358,6 +359,11 @@ AUD_DeviceSpecs AUD_SoftwareDevice::getSpecs() const
|
||||
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);
|
||||
@@ -372,7 +378,7 @@ AUD_Reference<AUD_IHandle> AUD_SoftwareDevice::play(AUD_Reference<AUD_IReader> r
|
||||
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);
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "AUD_IHandle.h"
|
||||
#include "AUD_Mixer.h"
|
||||
#include "AUD_Buffer.h"
|
||||
#include "AUD_PitchReader.h"
|
||||
|
||||
#include <list>
|
||||
#include <pthread.h>
|
||||
@@ -58,6 +59,9 @@ protected:
|
||||
/// 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;
|
||||
|
||||
@@ -81,7 +85,7 @@ protected:
|
||||
|
||||
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();
|
||||
|
Reference in New Issue
Block a user