diff options
Diffstat (limited to 'intern/audaspace/FX')
77 files changed, 0 insertions, 4856 deletions
diff --git a/intern/audaspace/FX/AUD_AccumulatorFactory.cpp b/intern/audaspace/FX/AUD_AccumulatorFactory.cpp deleted file mode 100644 index 00d3a9f2395..00000000000 --- a/intern/audaspace/FX/AUD_AccumulatorFactory.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * ***** 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/FX/AUD_AccumulatorFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_AccumulatorFactory.h" -#include "AUD_CallbackIIRFilterReader.h" - -sample_t AUD_AccumulatorFactory::accumulatorFilterAdditive(AUD_CallbackIIRFilterReader* reader, void* useless) -{ - float in = reader->x(0); - float lastin = reader->x(-1); - float out = reader->y(-1) + in - lastin; - if(in > lastin) - out += in - lastin; - return out; -} - -sample_t AUD_AccumulatorFactory::accumulatorFilter(AUD_CallbackIIRFilterReader* reader, void* useless) -{ - float in = reader->x(0); - float lastin = reader->x(-1); - float out = reader->y(-1); - if(in > lastin) - out += in - lastin; - return out; -} - -AUD_AccumulatorFactory::AUD_AccumulatorFactory(boost::shared_ptr<AUD_IFactory> factory, - bool additive) : - AUD_EffectFactory(factory), - m_additive(additive) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_AccumulatorFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_CallbackIIRFilterReader(getReader(), 2, 2, - m_additive ? accumulatorFilterAdditive : accumulatorFilter)); -} diff --git a/intern/audaspace/FX/AUD_AccumulatorFactory.h b/intern/audaspace/FX/AUD_AccumulatorFactory.h deleted file mode 100644 index 9087218a5f9..00000000000 --- a/intern/audaspace/FX/AUD_AccumulatorFactory.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * ***** 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/FX/AUD_AccumulatorFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_ACCUMULATORFACTORY_H__ -#define __AUD_ACCUMULATORFACTORY_H__ - -#include "AUD_EffectFactory.h" -class AUD_CallbackIIRFilterReader; - -/** - * This factory creates an accumulator reader. - * - * The accumulator adds the difference at the input to the last output in case - * it's positive. In additive mode it additionaly adds the difference always. - * So in case the difference is positive, it's added twice. - */ -class AUD_AccumulatorFactory : public AUD_EffectFactory -{ -private: - /** - * Whether the accumulator is additive. - */ - const bool m_additive; - - // hide copy constructor and operator= - AUD_AccumulatorFactory(const AUD_AccumulatorFactory&); - AUD_AccumulatorFactory& operator=(const AUD_AccumulatorFactory&); - -public: - /** - * Creates a new accumulator factory. - * \param factory The input factory. - * \param additive Whether the accumulator is additive. - */ - AUD_AccumulatorFactory(boost::shared_ptr<AUD_IFactory> factory, bool additive = false); - - virtual boost::shared_ptr<AUD_IReader> createReader(); - - static sample_t accumulatorFilterAdditive(AUD_CallbackIIRFilterReader* reader, void* useless); - static sample_t accumulatorFilter(AUD_CallbackIIRFilterReader* reader, void* useless); -}; - -#endif //__AUD_ACCUMULATORFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_BandpassCalculator.cpp b/intern/audaspace/FX/AUD_BandpassCalculator.cpp deleted file mode 100644 index f5bbd63f81c..00000000000 --- a/intern/audaspace/FX/AUD_BandpassCalculator.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "AUD_BandpassCalculator.h" - -AUD_BandpassCalculator::AUD_BandpassCalculator() -{ -} diff --git a/intern/audaspace/FX/AUD_BandpassCalculator.h b/intern/audaspace/FX/AUD_BandpassCalculator.h deleted file mode 100644 index b5b3cad17ca..00000000000 --- a/intern/audaspace/FX/AUD_BandpassCalculator.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef AUD_BANDPASSCALCULATOR_H -#define AUD_BANDPASSCALCULATOR_H - -class AUD_BandpassCalculator -{ -public: - AUD_BandpassCalculator(); -}; - -#endif // AUD_BANDPASSCALCULATOR_H diff --git a/intern/audaspace/FX/AUD_BaseIIRFilterReader.cpp b/intern/audaspace/FX/AUD_BaseIIRFilterReader.cpp deleted file mode 100644 index eadfc525f96..00000000000 --- a/intern/audaspace/FX/AUD_BaseIIRFilterReader.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * ***** 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/FX/AUD_BaseIIRFilterReader.cpp - * \ingroup audfx - */ - - -#include "AUD_BaseIIRFilterReader.h" - -#include <cstring> - -#define CC m_specs.channels + m_channel - -AUD_BaseIIRFilterReader::AUD_BaseIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, int in, - int out) : - AUD_EffectReader(reader), - m_specs(reader->getSpecs()), - m_xlen(in), m_ylen(out), - m_xpos(0), m_ypos(0), m_channel(0) -{ - m_x = new sample_t[m_xlen * m_specs.channels]; - m_y = new sample_t[m_ylen * m_specs.channels]; - - memset(m_x, 0, sizeof(sample_t) * m_xlen * m_specs.channels); - memset(m_y, 0, sizeof(sample_t) * m_ylen * m_specs.channels); -} - -AUD_BaseIIRFilterReader::~AUD_BaseIIRFilterReader() -{ - delete[] m_x; - delete[] m_y; -} - -void AUD_BaseIIRFilterReader::setLengths(int in, int out) -{ - if(in != m_xlen) - { - sample_t* xn = new sample_t[in * m_specs.channels]; - memset(xn, 0, sizeof(sample_t) * in * m_specs.channels); - - for(m_channel = 0; m_channel < m_specs.channels; m_channel++) - { - for(int i = 1; i <= in && i <= m_xlen; i++) - { - xn[(in - i) * CC] = x(-i); - } - } - - delete[] m_x; - m_x = xn; - m_xpos = 0; - m_xlen = in; - } - - if(out != m_ylen) - { - sample_t* yn = new sample_t[out * m_specs.channels]; - memset(yn, 0, sizeof(sample_t) * out * m_specs.channels); - - for(m_channel = 0; m_channel < m_specs.channels; m_channel++) - { - for(int i = 1; i <= out && i <= m_ylen; i++) - { - yn[(out - i) * CC] = y(-i); - } - } - - delete[] m_y; - m_y = yn; - m_ypos = 0; - m_ylen = out; - } -} - -void AUD_BaseIIRFilterReader::read(int& length, bool& eos, sample_t* buffer) -{ - AUD_Specs specs = m_reader->getSpecs(); - if(specs.channels != m_specs.channels) - { - m_specs.channels = specs.channels; - - delete[] m_x; - delete[] m_y; - - m_x = new sample_t[m_xlen * m_specs.channels]; - m_y = new sample_t[m_ylen * m_specs.channels]; - - memset(m_x, 0, sizeof(sample_t) * m_xlen * m_specs.channels); - memset(m_y, 0, sizeof(sample_t) * m_ylen * m_specs.channels); - } - - if(specs.rate != m_specs.rate) - { - m_specs = specs; - sampleRateChanged(m_specs.rate); - } - - m_reader->read(length, eos, buffer); - - for(m_channel = 0; m_channel < m_specs.channels; m_channel++) - { - for(int i = 0; i < length; i++) - { - m_x[m_xpos * CC] = buffer[i * CC]; - m_y[m_ypos * CC] = buffer[i * CC] = filter(); - - m_xpos = (m_xpos + 1) % m_xlen; - m_ypos = (m_ypos + 1) % m_ylen; - } - } -} - -void AUD_BaseIIRFilterReader::sampleRateChanged(AUD_SampleRate rate) -{ -} diff --git a/intern/audaspace/FX/AUD_BaseIIRFilterReader.h b/intern/audaspace/FX/AUD_BaseIIRFilterReader.h deleted file mode 100644 index fe0a8efce64..00000000000 --- a/intern/audaspace/FX/AUD_BaseIIRFilterReader.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * ***** 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/FX/AUD_BaseIIRFilterReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_BASEIIRFILTERREADER_H__ -#define __AUD_BASEIIRFILTERREADER_H__ - -#include "AUD_EffectReader.h" -#include "AUD_Buffer.h" - -/** - * This class is a base class for infinite impulse response filters. - */ -class AUD_BaseIIRFilterReader : public AUD_EffectReader -{ -private: - /** - * Specs. - */ - AUD_Specs m_specs; - - /** - * Length of input samples needed. - */ - int m_xlen; - - /** - * Length of output samples needed. - */ - int m_ylen; - - /** - * The last in samples array. - */ - sample_t* m_x; - - /** - * The last out samples array. - */ - sample_t* m_y; - - /** - * Position of the current input sample in the input array. - */ - int m_xpos; - - /** - * Position of the current output sample in the output array. - */ - int m_ypos; - - /** - * Current channel. - */ - int m_channel; - - // hide copy constructor and operator= - AUD_BaseIIRFilterReader(const AUD_BaseIIRFilterReader&); - AUD_BaseIIRFilterReader& operator=(const AUD_BaseIIRFilterReader&); - -protected: - /** - * Creates a new base IIR filter reader. - * \param reader The reader to read from. - * \param in The count of past input samples needed. - * \param out The count of past output samples needed. - */ - AUD_BaseIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, int in, int out); - - void setLengths(int in, int out); - -public: - /** - * Retrieves the last input samples. - * \param pos The position, valid are 0 (current) or negative values. - * \return The sample value. - */ - inline sample_t x(int pos) - { - return m_x[(m_xpos + pos + m_xlen) % m_xlen * m_specs.channels + m_channel]; - } - - /** - * Retrieves the last output samples. - * \param pos The position, valid are negative values. - * \return The sample value. - */ - inline sample_t y(int pos) - { - return m_y[(m_ypos + pos + m_ylen) % m_ylen * m_specs.channels + m_channel]; - } - - virtual ~AUD_BaseIIRFilterReader(); - - virtual void read(int& length, bool& eos, sample_t* buffer); - - /** - * Runs the filtering function. - * \return The current output sample value. - */ - virtual sample_t filter()=0; - - /** - * Notifies the filter about a sample rate change. - * \param rate The new sample rate. - */ - virtual void sampleRateChanged(AUD_SampleRate rate); -}; - -#endif //__AUD_BASEIIRFILTERREADER_H__ diff --git a/intern/audaspace/FX/AUD_ButterworthCalculator.cpp b/intern/audaspace/FX/AUD_ButterworthCalculator.cpp deleted file mode 100644 index 7a3c6f71e15..00000000000 --- a/intern/audaspace/FX/AUD_ButterworthCalculator.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "AUD_ButterworthCalculator.h" - -#include <cmath> - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#define BWPB41 0.76536686473 -#define BWPB42 1.84775906502 - -AUD_ButterworthCalculator::AUD_ButterworthCalculator(float frequency) : - m_frequency(frequency) -{ -} - -void AUD_ButterworthCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a) -{ - float omega = 2 * tan(m_frequency * M_PI / rate); - float o2 = omega * omega; - float o4 = o2 * o2; - float x1 = o2 + 2.0f * (float)BWPB41 * omega + 4.0f; - float x2 = o2 + 2.0f * (float)BWPB42 * omega + 4.0f; - float y1 = o2 - 2.0f * (float)BWPB41 * omega + 4.0f; - float y2 = o2 - 2.0f * (float)BWPB42 * omega + 4.0f; - float o228 = 2.0f * o2 - 8.0f; - float norm = x1 * x2; - a.push_back(1); - a.push_back((x1 + x2) * o228 / norm); - a.push_back((x1 * y2 + x2 * y1 + o228 * o228) / norm); - a.push_back((y1 + y2) * o228 / norm); - a.push_back(y1 * y2 / norm); - b.push_back(o4 / norm); - b.push_back(4 * o4 / norm); - b.push_back(6 * o4 / norm); - b.push_back(b[1]); - b.push_back(b[0]); -} diff --git a/intern/audaspace/FX/AUD_ButterworthCalculator.h b/intern/audaspace/FX/AUD_ButterworthCalculator.h deleted file mode 100644 index a7ae196afda..00000000000 --- a/intern/audaspace/FX/AUD_ButterworthCalculator.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef AUD_BUTTERWORTHCALCULATOR_H -#define AUD_BUTTERWORTHCALCULATOR_H - -#include "AUD_IDynamicIIRFilterCalculator.h" - -class AUD_ButterworthCalculator : public AUD_IDynamicIIRFilterCalculator -{ -private: - /** - * The attack value in seconds. - */ - const float m_frequency; - -public: - AUD_ButterworthCalculator(float frequency); - - virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a); -}; - -#endif // AUD_BUTTERWORTHCALCULATOR_H diff --git a/intern/audaspace/FX/AUD_ButterworthFactory.cpp b/intern/audaspace/FX/AUD_ButterworthFactory.cpp deleted file mode 100644 index 12c4306c2f7..00000000000 --- a/intern/audaspace/FX/AUD_ButterworthFactory.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * ***** 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/FX/AUD_ButterworthFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_ButterworthFactory.h" -#include "AUD_IIRFilterReader.h" -#include "AUD_ButterworthCalculator.h" - -AUD_ButterworthFactory::AUD_ButterworthFactory(boost::shared_ptr<AUD_IFactory> factory, - float frequency) : - AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_ButterworthCalculator(frequency))) -{ -} - diff --git a/intern/audaspace/FX/AUD_ButterworthFactory.h b/intern/audaspace/FX/AUD_ButterworthFactory.h deleted file mode 100644 index 3a86b14a7a6..00000000000 --- a/intern/audaspace/FX/AUD_ButterworthFactory.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ***** 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/FX/AUD_ButterworthFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_BUTTERWORTHFACTORY_H__ -#define __AUD_BUTTERWORTHFACTORY_H__ - -#include "AUD_DynamicIIRFilterFactory.h" - -/** - * This factory creates a butterworth lowpass filter reader. - */ -class AUD_ButterworthFactory : public AUD_DynamicIIRFilterFactory -{ -private: - // hide copy constructor and operator= - AUD_ButterworthFactory(const AUD_ButterworthFactory&); - AUD_ButterworthFactory& operator=(const AUD_ButterworthFactory&); - -public: - /** - * Creates a new butterworth factory. - * \param factory The input factory. - * \param frequency The cutoff frequency. - */ - AUD_ButterworthFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency); -}; - -#endif //__AUD_BUTTERWORTHFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.cpp b/intern/audaspace/FX/AUD_CallbackIIRFilterReader.cpp deleted file mode 100644 index b5157d47666..00000000000 --- a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * ***** 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/FX/AUD_CallbackIIRFilterReader.cpp - * \ingroup audfx - */ - - -#include "AUD_CallbackIIRFilterReader.h" - -AUD_CallbackIIRFilterReader::AUD_CallbackIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, - int in, int out, - doFilterIIR doFilter, - endFilterIIR endFilter, - void* data) : - AUD_BaseIIRFilterReader(reader, in, out), - m_filter(doFilter), m_endFilter(endFilter), m_data(data) -{ -} - -AUD_CallbackIIRFilterReader::~AUD_CallbackIIRFilterReader() -{ - if(m_endFilter) - m_endFilter(m_data); -} - -sample_t AUD_CallbackIIRFilterReader::filter() -{ - return m_filter(this, m_data); -} diff --git a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h b/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h deleted file mode 100644 index 66f82ba1a01..00000000000 --- a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * ***** 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/FX/AUD_CallbackIIRFilterReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_CALLBACKIIRFILTERREADER_H__ -#define __AUD_CALLBACKIIRFILTERREADER_H__ - -#include "AUD_BaseIIRFilterReader.h" -#include "AUD_Buffer.h" - -class AUD_CallbackIIRFilterReader; - -typedef sample_t (*doFilterIIR)(AUD_CallbackIIRFilterReader*, void*); -typedef void (*endFilterIIR)(void*); - -/** - * This class provides an interface for infinite impulse response filters via a - * callback filter function. - */ -class AUD_CallbackIIRFilterReader : public AUD_BaseIIRFilterReader -{ -private: - /** - * Filter function. - */ - const doFilterIIR m_filter; - - /** - * End filter function. - */ - const endFilterIIR m_endFilter; - - /** - * Data pointer. - */ - void* m_data; - - // hide copy constructor and operator= - AUD_CallbackIIRFilterReader(const AUD_CallbackIIRFilterReader&); - AUD_CallbackIIRFilterReader& operator=(const AUD_CallbackIIRFilterReader&); - -public: - /** - * Creates a new callback IIR filter reader. - * \param reader The reader to read from. - * \param in The count of past input samples needed. - * \param out The count of past output samples needed. - * \param doFilter The filter callback. - * \param endFilter The finishing callback. - * \param data Data pointer for the callbacks. - */ - AUD_CallbackIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, int in, int out, - doFilterIIR doFilter, - endFilterIIR endFilter = 0, - void* data = NULL); - - virtual ~AUD_CallbackIIRFilterReader(); - - virtual sample_t filter(); -}; - -#endif //__AUD_CALLBACKIIRFILTERREADER_H__ diff --git a/intern/audaspace/FX/AUD_DelayFactory.cpp b/intern/audaspace/FX/AUD_DelayFactory.cpp deleted file mode 100644 index 3e5a7cfd2f8..00000000000 --- a/intern/audaspace/FX/AUD_DelayFactory.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ***** 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/FX/AUD_DelayFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_DelayFactory.h" -#include "AUD_DelayReader.h" -#include "AUD_Space.h" - -AUD_DelayFactory::AUD_DelayFactory(boost::shared_ptr<AUD_IFactory> factory, float delay) : - AUD_EffectFactory(factory), - m_delay(delay) -{ -} - -float AUD_DelayFactory::getDelay() const -{ - return m_delay; -} - -boost::shared_ptr<AUD_IReader> AUD_DelayFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_DelayReader(getReader(), m_delay)); -} diff --git a/intern/audaspace/FX/AUD_DelayFactory.h b/intern/audaspace/FX/AUD_DelayFactory.h deleted file mode 100644 index 8cfb2be9ac8..00000000000 --- a/intern/audaspace/FX/AUD_DelayFactory.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ***** 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/FX/AUD_DelayFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_DELAYFACTORY_H__ -#define __AUD_DELAYFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory plays another factory delayed. - */ -class AUD_DelayFactory : public AUD_EffectFactory -{ -private: - /** - * The delay in samples. - */ - const float m_delay; - - // hide copy constructor and operator= - AUD_DelayFactory(const AUD_DelayFactory&); - AUD_DelayFactory& operator=(const AUD_DelayFactory&); - -public: - /** - * Creates a new delay factory. - * \param factory The input factory. - * \param delay The desired delay in seconds. - */ - AUD_DelayFactory(boost::shared_ptr<AUD_IFactory> factory, float delay = 0); - - /** - * Returns the delay in seconds. - */ - float getDelay() const; - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_DELAYFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_DelayReader.cpp b/intern/audaspace/FX/AUD_DelayReader.cpp deleted file mode 100644 index 050508f28da..00000000000 --- a/intern/audaspace/FX/AUD_DelayReader.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * ***** 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/FX/AUD_DelayReader.cpp - * \ingroup audfx - */ - - -#include "AUD_DelayReader.h" - -#include <cstring> - -AUD_DelayReader::AUD_DelayReader(boost::shared_ptr<AUD_IReader> reader, float delay) : - AUD_EffectReader(reader), - m_delay(int((AUD_SampleRate)delay * reader->getSpecs().rate)), - m_remdelay(int((AUD_SampleRate)delay * reader->getSpecs().rate)) -{ -} - -void AUD_DelayReader::seek(int position) -{ - if(position < m_delay) - { - m_remdelay = m_delay - position; - m_reader->seek(0); - } - else - { - m_remdelay = 0; - m_reader->seek(position - m_delay); - } -} - -int AUD_DelayReader::getLength() const -{ - int len = m_reader->getLength(); - if(len < 0) - return len; - return len + m_delay; -} - -int AUD_DelayReader::getPosition() const -{ - if(m_remdelay > 0) - return m_delay - m_remdelay; - return m_reader->getPosition() + m_delay; -} - -void AUD_DelayReader::read(int& length, bool& eos, sample_t* buffer) -{ - if(m_remdelay > 0) - { - AUD_Specs specs = m_reader->getSpecs(); - int samplesize = AUD_SAMPLE_SIZE(specs); - - if(length > m_remdelay) - { - memset(buffer, 0, m_remdelay * samplesize); - - int len = length - m_remdelay; - m_reader->read(len, eos, buffer + m_remdelay * specs.channels); - - length = m_remdelay + len; - - m_remdelay = 0; - } - else - { - memset(buffer, 0, length * samplesize); - m_remdelay -= length; - } - } - else - m_reader->read(length, eos, buffer); -} diff --git a/intern/audaspace/FX/AUD_DelayReader.h b/intern/audaspace/FX/AUD_DelayReader.h deleted file mode 100644 index d4388e3befc..00000000000 --- a/intern/audaspace/FX/AUD_DelayReader.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * ***** 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/FX/AUD_DelayReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_DELAYREADER_H__ -#define __AUD_DELAYREADER_H__ - -#include "AUD_EffectReader.h" -#include "AUD_Buffer.h" - -/** - * This class reads another reader and delays it. - */ -class AUD_DelayReader : public AUD_EffectReader -{ -private: - /** - * The delay level. - */ - const int m_delay; - - /** - * The remaining delay for playback. - */ - int m_remdelay; - - // hide copy constructor and operator= - AUD_DelayReader(const AUD_DelayReader&); - AUD_DelayReader& operator=(const AUD_DelayReader&); - -public: - /** - * Creates a new delay reader. - * \param reader The reader to read from. - * \param delay The delay in seconds. - */ - AUD_DelayReader(boost::shared_ptr<AUD_IReader> reader, float delay); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -#endif //__AUD_DELAYREADER_H__ diff --git a/intern/audaspace/FX/AUD_DoubleFactory.cpp b/intern/audaspace/FX/AUD_DoubleFactory.cpp deleted file mode 100644 index 21bcbc2f649..00000000000 --- a/intern/audaspace/FX/AUD_DoubleFactory.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ***** 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/FX/AUD_DoubleFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_DoubleFactory.h" -#include "AUD_DoubleReader.h" - -AUD_DoubleFactory::AUD_DoubleFactory(boost::shared_ptr<AUD_IFactory> factory1, boost::shared_ptr<AUD_IFactory> factory2) : - m_factory1(factory1), m_factory2(factory2) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_DoubleFactory::createReader() -{ - boost::shared_ptr<AUD_IReader> reader1 = m_factory1->createReader(); - boost::shared_ptr<AUD_IReader> reader2 = m_factory2->createReader(); - - return boost::shared_ptr<AUD_IReader>(new AUD_DoubleReader(reader1, reader2)); -} diff --git a/intern/audaspace/FX/AUD_DoubleFactory.h b/intern/audaspace/FX/AUD_DoubleFactory.h deleted file mode 100644 index 4a02cc7bcdb..00000000000 --- a/intern/audaspace/FX/AUD_DoubleFactory.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ***** 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/FX/AUD_DoubleFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_DOUBLEFACTORY_H__ -#define __AUD_DOUBLEFACTORY_H__ - -#include "AUD_IFactory.h" - -/** - * This factory plays two other factories behind each other. - */ -class AUD_DoubleFactory : public AUD_IFactory -{ -private: - /** - * First played factory. - */ - boost::shared_ptr<AUD_IFactory> m_factory1; - - /** - * Second played factory. - */ - boost::shared_ptr<AUD_IFactory> m_factory2; - - // hide copy constructor and operator= - AUD_DoubleFactory(const AUD_DoubleFactory&); - AUD_DoubleFactory& operator=(const AUD_DoubleFactory&); - -public: - /** - * Creates a new double factory. - * \param factory1 The first input factory. - * \param factory2 The second input factory. - */ - AUD_DoubleFactory(boost::shared_ptr<AUD_IFactory> factory1, boost::shared_ptr<AUD_IFactory> factory2); - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_DOUBLEFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_DoubleReader.cpp b/intern/audaspace/FX/AUD_DoubleReader.cpp deleted file mode 100644 index ee18914e93f..00000000000 --- a/intern/audaspace/FX/AUD_DoubleReader.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - * ***** 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/FX/AUD_DoubleReader.cpp - * \ingroup audfx - */ - - -#include "AUD_DoubleReader.h" - -#include <cstring> - -AUD_DoubleReader::AUD_DoubleReader(boost::shared_ptr<AUD_IReader> reader1, - boost::shared_ptr<AUD_IReader> reader2) : - m_reader1(reader1), m_reader2(reader2), m_finished1(false) -{ - AUD_Specs s1, s2; - s1 = reader1->getSpecs(); - s2 = reader2->getSpecs(); -} - -AUD_DoubleReader::~AUD_DoubleReader() -{ -} - -bool AUD_DoubleReader::isSeekable() const -{ - return m_reader1->isSeekable() && m_reader2->isSeekable(); -} - -void AUD_DoubleReader::seek(int position) -{ - m_reader1->seek(position); - - int pos1 = m_reader1->getPosition(); - - if((m_finished1 = (pos1 < position))) - m_reader2->seek(position - pos1); - else - m_reader2->seek(0); -} - -int AUD_DoubleReader::getLength() const -{ - int len1 = m_reader1->getLength(); - int len2 = m_reader2->getLength(); - if(len1 < 0 || len2 < 0) - return -1; - return len1 + len2; -} - -int AUD_DoubleReader::getPosition() const -{ - return m_reader1->getPosition() + m_reader2->getPosition(); -} - -AUD_Specs AUD_DoubleReader::getSpecs() const -{ - return m_finished1 ? m_reader1->getSpecs() : m_reader2->getSpecs(); -} - -void AUD_DoubleReader::read(int& length, bool& eos, sample_t* buffer) -{ - eos = false; - - if(!m_finished1) - { - int len = length; - - m_reader1->read(len, m_finished1, buffer); - - if(len < length) - { - AUD_Specs specs1, specs2; - specs1 = m_reader1->getSpecs(); - specs2 = m_reader2->getSpecs(); - if(AUD_COMPARE_SPECS(specs1, specs2)) - { - int len2 = length - len; - m_reader2->read(len2, eos, buffer + specs1.channels * len); - length = len + len2; - } - else - length = len; - } - } - else - { - m_reader2->read(length, eos, buffer); - } -} diff --git a/intern/audaspace/FX/AUD_DoubleReader.h b/intern/audaspace/FX/AUD_DoubleReader.h deleted file mode 100644 index 5d2f65f1a90..00000000000 --- a/intern/audaspace/FX/AUD_DoubleReader.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***** 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/FX/AUD_DoubleReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_DOUBLEREADER_H__ -#define __AUD_DOUBLEREADER_H__ - -#include "AUD_IReader.h" -#include "AUD_Buffer.h" - -#include <boost/shared_ptr.hpp> - -/** - * This reader plays two readers sequently. - */ -class AUD_DoubleReader : public AUD_IReader -{ -private: - /** - * The first reader. - */ - boost::shared_ptr<AUD_IReader> m_reader1; - - /** - * The second reader. - */ - boost::shared_ptr<AUD_IReader> m_reader2; - - /** - * Whether we've reached the end of the first reader. - */ - bool m_finished1; - - // hide copy constructor and operator= - AUD_DoubleReader(const AUD_DoubleReader&); - AUD_DoubleReader& operator=(const AUD_DoubleReader&); - -public: - /** - * Creates a new double reader. - * \param reader1 The first reader to read from. - * \param reader2 The second reader to read from. - */ - AUD_DoubleReader(boost::shared_ptr<AUD_IReader> reader1, boost::shared_ptr<AUD_IReader> reader2); - - /** - * Destroys the reader. - */ - virtual ~AUD_DoubleReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual AUD_Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -#endif //__AUD_DOUBLEREADER_H__ diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.cpp b/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.cpp deleted file mode 100644 index 319a78cfedd..00000000000 --- a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ***** 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/FX/AUD_DynamicIIRFilterFactory.cpp - * \ingroup audfx - */ - -#include "AUD_DynamicIIRFilterFactory.h" -#include "AUD_DynamicIIRFilterReader.h" - - -AUD_DynamicIIRFilterFactory::AUD_DynamicIIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory, - boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator) : - AUD_EffectFactory(factory), - m_calculator(calculator) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_DynamicIIRFilterFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_DynamicIIRFilterReader(getReader(), m_calculator)); -} - diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h b/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h deleted file mode 100644 index aece7a8c2ef..00000000000 --- a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ***** 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/FX/AUD_DynamicIIRFilterFactory.h - * \ingroup audfx - */ - -#ifndef __AUD_DYNAMICIIRFILTERFACTORY_H__ -#define __AUD_DYNAMICIIRFILTERFACTORY_H__ - -#include "AUD_EffectFactory.h" -#include "AUD_IDynamicIIRFilterCalculator.h" -#include <vector> - -/** - * This factory creates a IIR filter reader. - * - * This means that on sample rate change the filter recalculates its - * coefficients. - */ -class AUD_DynamicIIRFilterFactory : public AUD_EffectFactory -{ -protected: - boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> m_calculator; - -public: - /** - * Creates a new Dynmic IIR filter factory. - * \param factory The input factory. - */ - AUD_DynamicIIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory, - boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator); - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif // __AUD_DYNAMICIIRFILTERFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp deleted file mode 100644 index 52aaf2311c0..00000000000 --- a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ***** 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/FX/AUD_DynamicIIRFilterReader.cpp - * \ingroup audfx - */ - -#include "AUD_DynamicIIRFilterReader.h" - -AUD_DynamicIIRFilterReader::AUD_DynamicIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, - boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator) : - AUD_IIRFilterReader(reader, std::vector<float>(), std::vector<float>()), - m_calculator(calculator) -{ - sampleRateChanged(reader->getSpecs().rate); -} - -void AUD_DynamicIIRFilterReader::sampleRateChanged(AUD_SampleRate rate) -{ - std::vector<float> a, b; - m_calculator->recalculateCoefficients(rate, b, a); - setCoefficients(b, a); -} diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h deleted file mode 100644 index 0b68578bc53..00000000000 --- a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ***** 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/FX/AUD_DynamicIIRFilterReader.h - * \ingroup audfx - */ - -#ifndef __AUD_DYNAMICIIRFILTERREADER_H__ -#define __AUD_DYNAMICIIRFILTERREADER_H__ - -#include "AUD_IIRFilterReader.h" -#include "AUD_IDynamicIIRFilterCalculator.h" - -/** - * This class is for dynamic infinite impulse response filters with simple - * coefficients that change depending on the sample rate. - */ -class AUD_DynamicIIRFilterReader : public AUD_IIRFilterReader -{ -private: - /** - * The factory for dynamically recalculating filter coefficients. - */ - boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> m_calculator; - -public: - AUD_DynamicIIRFilterReader(boost::shared_ptr<AUD_IReader> reader, - boost::shared_ptr<AUD_IDynamicIIRFilterCalculator> calculator); - - virtual void sampleRateChanged(AUD_SampleRate rate); -}; - -#endif // __AUD_DYNAMICIIRFILTERREADER_H__ diff --git a/intern/audaspace/FX/AUD_EffectFactory.cpp b/intern/audaspace/FX/AUD_EffectFactory.cpp deleted file mode 100644 index 6018ed561ca..00000000000 --- a/intern/audaspace/FX/AUD_EffectFactory.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ***** 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/FX/AUD_EffectFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_EffectFactory.h" -#include "AUD_IReader.h" - -AUD_EffectFactory::AUD_EffectFactory(boost::shared_ptr<AUD_IFactory> factory) -{ - m_factory = factory; -} - -AUD_EffectFactory::~AUD_EffectFactory() -{ -} - -boost::shared_ptr<AUD_IFactory> AUD_EffectFactory::getFactory() const -{ - return m_factory; -} diff --git a/intern/audaspace/FX/AUD_EffectFactory.h b/intern/audaspace/FX/AUD_EffectFactory.h deleted file mode 100644 index d09872638be..00000000000 --- a/intern/audaspace/FX/AUD_EffectFactory.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * ***** 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/FX/AUD_EffectFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_EFFECTFACTORY_H__ -#define __AUD_EFFECTFACTORY_H__ - -#include "AUD_IFactory.h" - -/** - * This factory is a base class for all effect factories that take one other - * factory as input. - */ -class AUD_EffectFactory : public AUD_IFactory -{ -private: - // hide copy constructor and operator= - AUD_EffectFactory(const AUD_EffectFactory&); - AUD_EffectFactory& operator=(const AUD_EffectFactory&); - -protected: - /** - * If there is no reader it is created out of this factory. - */ - boost::shared_ptr<AUD_IFactory> m_factory; - - /** - * Returns the reader created out of the factory. - * This method can be used for the createReader function of the implementing - * classes. - * \return The reader created out of the factory. - */ - inline boost::shared_ptr<AUD_IReader> getReader() const - { - return m_factory->createReader(); - } - -public: - /** - * Creates a new factory. - * \param factory The input factory. - */ - AUD_EffectFactory(boost::shared_ptr<AUD_IFactory> factory); - - /** - * Destroys the factory. - */ - virtual ~AUD_EffectFactory(); - - /** - * Returns the saved factory. - * \return The factory or NULL if there has no factory been saved. - */ - boost::shared_ptr<AUD_IFactory> getFactory() const; -}; - -#endif //__AUD_EFFECTFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_EffectReader.cpp b/intern/audaspace/FX/AUD_EffectReader.cpp deleted file mode 100644 index b3e80bef03b..00000000000 --- a/intern/audaspace/FX/AUD_EffectReader.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * ***** 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/FX/AUD_EffectReader.cpp - * \ingroup audfx - */ - - -#include "AUD_EffectReader.h" - -AUD_EffectReader::AUD_EffectReader(boost::shared_ptr<AUD_IReader> reader) -{ - m_reader = reader; -} - -AUD_EffectReader::~AUD_EffectReader() -{ -} - -bool AUD_EffectReader::isSeekable() const -{ - return m_reader->isSeekable(); -} - -void AUD_EffectReader::seek(int position) -{ - m_reader->seek(position); -} - -int AUD_EffectReader::getLength() const -{ - return m_reader->getLength(); -} - -int AUD_EffectReader::getPosition() const -{ - return m_reader->getPosition(); -} - -AUD_Specs AUD_EffectReader::getSpecs() const -{ - return m_reader->getSpecs(); -} - -void AUD_EffectReader::read(int& length, bool& eos, sample_t* buffer) -{ - m_reader->read(length, eos, buffer); -} diff --git a/intern/audaspace/FX/AUD_EffectReader.h b/intern/audaspace/FX/AUD_EffectReader.h deleted file mode 100644 index 2745c12afaf..00000000000 --- a/intern/audaspace/FX/AUD_EffectReader.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * ***** 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/FX/AUD_EffectReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_EFFECTREADER_H__ -#define __AUD_EFFECTREADER_H__ - -#include "AUD_IReader.h" - -#include <boost/shared_ptr.hpp> - -/** - * This reader is a base class for all effect readers that take one other reader - * as input. - */ -class AUD_EffectReader : public AUD_IReader -{ -private: - // hide copy constructor and operator= - AUD_EffectReader(const AUD_EffectReader&); - AUD_EffectReader& operator=(const AUD_EffectReader&); - -protected: - /** - * The reader to read from. - */ - boost::shared_ptr<AUD_IReader> m_reader; - -public: - /** - * Creates a new effect reader. - * \param reader The reader to read from. - */ - AUD_EffectReader(boost::shared_ptr<AUD_IReader> reader); - - /** - * Destroys the reader. - */ - virtual ~AUD_EffectReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual AUD_Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -#endif //__AUD_EFFECTREADER_H__ diff --git a/intern/audaspace/FX/AUD_EnvelopeFactory.cpp b/intern/audaspace/FX/AUD_EnvelopeFactory.cpp deleted file mode 100644 index 1e5737557c1..00000000000 --- a/intern/audaspace/FX/AUD_EnvelopeFactory.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * ***** 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/FX/AUD_EnvelopeFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_EnvelopeFactory.h" -#include "AUD_CallbackIIRFilterReader.h" - -#include <cmath> - -struct EnvelopeParameters -{ - float attack; - float release; - float threshold; - float arthreshold; -}; - -sample_t AUD_EnvelopeFactory::envelopeFilter(AUD_CallbackIIRFilterReader* reader, EnvelopeParameters* param) -{ - float in = fabs(reader->x(0)); - float out = reader->y(-1); - if(in < param->threshold) - in = 0.0f; - return (in > out ? param->attack : param->release) * (out - in) + in; -} - -void AUD_EnvelopeFactory::endEnvelopeFilter(EnvelopeParameters* param) -{ - delete param; -} - -AUD_EnvelopeFactory::AUD_EnvelopeFactory(boost::shared_ptr<AUD_IFactory> factory, float attack, - float release, float threshold, - float arthreshold) : - AUD_EffectFactory(factory), - m_attack(attack), - m_release(release), - m_threshold(threshold), - m_arthreshold(arthreshold) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_EnvelopeFactory::createReader() -{ - boost::shared_ptr<AUD_IReader> reader = getReader(); - - EnvelopeParameters* param = new EnvelopeParameters(); - param->arthreshold = m_arthreshold; - param->attack = pow(m_arthreshold, 1.0f/(static_cast<float>(reader->getSpecs().rate) * m_attack)); - param->release = pow(m_arthreshold, 1.0f/(static_cast<float>(reader->getSpecs().rate) * m_release)); - param->threshold = m_threshold; - - return boost::shared_ptr<AUD_IReader>(new AUD_CallbackIIRFilterReader(reader, 1, 2, - (doFilterIIR) envelopeFilter, - (endFilterIIR) endEnvelopeFilter, - param)); -} diff --git a/intern/audaspace/FX/AUD_EnvelopeFactory.h b/intern/audaspace/FX/AUD_EnvelopeFactory.h deleted file mode 100644 index 656212c8cac..00000000000 --- a/intern/audaspace/FX/AUD_EnvelopeFactory.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***** 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/FX/AUD_EnvelopeFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_ENVELOPEFACTORY_H__ -#define __AUD_ENVELOPEFACTORY_H__ - -#include "AUD_EffectFactory.h" -class AUD_CallbackIIRFilterReader; -struct EnvelopeParameters; - -/** - * This factory creates an envelope follower reader. - */ -class AUD_EnvelopeFactory : public AUD_EffectFactory -{ -private: - /** - * The attack value in seconds. - */ - const float m_attack; - - /** - * The release value in seconds. - */ - const float m_release; - - /** - * The threshold value. - */ - const float m_threshold; - - /** - * The attack/release threshold value. - */ - const float m_arthreshold; - - // hide copy constructor and operator= - AUD_EnvelopeFactory(const AUD_EnvelopeFactory&); - AUD_EnvelopeFactory& operator=(const AUD_EnvelopeFactory&); - -public: - /** - * Creates a new envelope factory. - * \param factory The input factory. - * \param attack The attack value in seconds. - * \param release The release value in seconds. - * \param threshold The threshold value. - * \param arthreshold The attack/release threshold value. - */ - AUD_EnvelopeFactory(boost::shared_ptr<AUD_IFactory> factory, float attack, float release, - float threshold, float arthreshold); - - virtual boost::shared_ptr<AUD_IReader> createReader(); - - static sample_t envelopeFilter(AUD_CallbackIIRFilterReader* reader, EnvelopeParameters* param); - static void endEnvelopeFilter(EnvelopeParameters* param); -}; - -#endif //__AUD_ENVELOPEFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_FaderFactory.cpp b/intern/audaspace/FX/AUD_FaderFactory.cpp deleted file mode 100644 index b34d2134385..00000000000 --- a/intern/audaspace/FX/AUD_FaderFactory.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ***** 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/FX/AUD_FaderFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_FaderFactory.h" -#include "AUD_FaderReader.h" - -AUD_FaderFactory::AUD_FaderFactory(boost::shared_ptr<AUD_IFactory> factory, AUD_FadeType type, - float start, float length) : - AUD_EffectFactory(factory), - m_type(type), - m_start(start), - m_length(length) -{ -} - -AUD_FadeType AUD_FaderFactory::getType() const -{ - return m_type; -} - -float AUD_FaderFactory::getStart() const -{ - return m_start; -} - -float AUD_FaderFactory::getLength() const -{ - return m_length; -} - -boost::shared_ptr<AUD_IReader> AUD_FaderFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_FaderReader(getReader(), m_type, m_start, m_length)); -} diff --git a/intern/audaspace/FX/AUD_FaderFactory.h b/intern/audaspace/FX/AUD_FaderFactory.h deleted file mode 100644 index f9ad88a751d..00000000000 --- a/intern/audaspace/FX/AUD_FaderFactory.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * ***** 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/FX/AUD_FaderFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_FADERFACTORY_H__ -#define __AUD_FADERFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory fades another factory. - * If the fading type is AUD_FADE_IN, everything before the fading start will be - * silenced, for AUD_FADE_OUT that's true for everything after fading ends. - */ -class AUD_FaderFactory : public AUD_EffectFactory -{ -private: - /** - * The fading type. - */ - const AUD_FadeType m_type; - - /** - * The fading start. - */ - const float m_start; - - /** - * The fading length. - */ - const float m_length; - - // hide copy constructor and operator= - AUD_FaderFactory(const AUD_FaderFactory&); - AUD_FaderFactory& operator=(const AUD_FaderFactory&); - -public: - /** - * Creates a new fader factory. - * \param factory The input factory. - * \param type The fading type. - * \param start The time where fading should start in seconds. - * \param length How long fading should last in seconds. - */ - AUD_FaderFactory(boost::shared_ptr<AUD_IFactory> factory, - AUD_FadeType type = AUD_FADE_IN, - float start = 0.0f, float length = 1.0f); - - /** - * Returns the fading type. - */ - AUD_FadeType getType() const; - - /** - * Returns the fading start. - */ - float getStart() const; - - /** - * Returns the fading length. - */ - float getLength() const; - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_FADERFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_FaderReader.cpp b/intern/audaspace/FX/AUD_FaderReader.cpp deleted file mode 100644 index e09072054cb..00000000000 --- a/intern/audaspace/FX/AUD_FaderReader.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * ***** 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/FX/AUD_FaderReader.cpp - * \ingroup audfx - */ - - -#include "AUD_FaderReader.h" - -#include <cstring> - -AUD_FaderReader::AUD_FaderReader(boost::shared_ptr<AUD_IReader> reader, AUD_FadeType type, - float start,float length) : - AUD_EffectReader(reader), - m_type(type), - m_start(start), - m_length(length) -{ -} - -void AUD_FaderReader::read(int& length, bool& eos, sample_t* buffer) -{ - int position = m_reader->getPosition(); - AUD_Specs specs = m_reader->getSpecs(); - int samplesize = AUD_SAMPLE_SIZE(specs); - - m_reader->read(length, eos, buffer); - - if((position + length) / (float)specs.rate <= m_start) - { - if(m_type != AUD_FADE_OUT) - { - memset(buffer, 0, length * samplesize); - } - } - else if(position / (float)specs.rate >= m_start+m_length) - { - if(m_type == AUD_FADE_OUT) - { - memset(buffer, 0, length * samplesize); - } - } - else - { - float volume = 1.0f; - - for(int i = 0; i < length * specs.channels; i++) - { - if(i % specs.channels == 0) - { - volume = (((position+i)/(float)specs.rate)-m_start) / m_length; - if(volume > 1.0f) - volume = 1.0f; - else if(volume < 0.0f) - volume = 0.0f; - - if(m_type == AUD_FADE_OUT) - volume = 1.0f - volume; - } - - buffer[i] = buffer[i] * volume; - } - } -} diff --git a/intern/audaspace/FX/AUD_FaderReader.h b/intern/audaspace/FX/AUD_FaderReader.h deleted file mode 100644 index a49960b30fb..00000000000 --- a/intern/audaspace/FX/AUD_FaderReader.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * ***** 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/FX/AUD_FaderReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_FADERREADER_H__ -#define __AUD_FADERREADER_H__ - -#include "AUD_EffectReader.h" -#include "AUD_Buffer.h" - -/** - * This class fades another reader. - * If the fading type is AUD_FADE_IN, everything before the fading start will be - * silenced, for AUD_FADE_OUT that's true for everything after fading ends. - */ -class AUD_FaderReader : public AUD_EffectReader -{ -private: - /** - * The fading type. - */ - const AUD_FadeType m_type; - - /** - * The fading start. - */ - const float m_start; - - /** - * The fading length. - */ - const float m_length; - - // hide copy constructor and operator= - AUD_FaderReader(const AUD_FaderReader&); - AUD_FaderReader& operator=(const AUD_FaderReader&); - -public: - /** - * Creates a new fader reader. - * \param type The fading type. - * \param start The time where fading should start in seconds. - * \param length How long fading should last in seconds. - */ - AUD_FaderReader(boost::shared_ptr<AUD_IReader> reader, AUD_FadeType type, - float start,float length); - - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -#endif //__AUD_FADERREADER_H__ diff --git a/intern/audaspace/FX/AUD_HighpassCalculator.cpp b/intern/audaspace/FX/AUD_HighpassCalculator.cpp deleted file mode 100644 index 573bba1c62b..00000000000 --- a/intern/audaspace/FX/AUD_HighpassCalculator.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "AUD_HighpassCalculator.h" - -#include <cmath> - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -AUD_HighpassCalculator::AUD_HighpassCalculator(float frequency, float Q) : - m_frequency(frequency), - m_Q(Q) -{ -} - -void AUD_HighpassCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a) -{ - float w0 = 2.0 * M_PI * (AUD_SampleRate)m_frequency / rate; - float alpha = (float)(sin(w0) / (2.0 * (double)m_Q)); - float norm = 1 + alpha; - float c = cos(w0); - a.push_back(1); - a.push_back(-2 * c / norm); - a.push_back((1 - alpha) / norm); - b.push_back((1 + c) / (2 * norm)); - b.push_back((-1 - c) / norm); - b.push_back(b[0]); -} diff --git a/intern/audaspace/FX/AUD_HighpassCalculator.h b/intern/audaspace/FX/AUD_HighpassCalculator.h deleted file mode 100644 index bad1c08f7c7..00000000000 --- a/intern/audaspace/FX/AUD_HighpassCalculator.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef AUD_HIGHPASSCALCULATOR_H -#define AUD_HIGHPASSCALCULATOR_H - -#include "AUD_IDynamicIIRFilterCalculator.h" - -class AUD_HighpassCalculator : public AUD_IDynamicIIRFilterCalculator -{ -private: - /** - * The cutoff frequency. - */ - const float m_frequency; - - /** - * The Q factor. - */ - const float m_Q; - -public: - AUD_HighpassCalculator(float frequency, float Q); - - virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a); -}; - -#endif // AUD_HIGHPASSCALCULATOR_H diff --git a/intern/audaspace/FX/AUD_HighpassFactory.cpp b/intern/audaspace/FX/AUD_HighpassFactory.cpp deleted file mode 100644 index 2456085a8a1..00000000000 --- a/intern/audaspace/FX/AUD_HighpassFactory.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * ***** 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/FX/AUD_HighpassFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_HighpassFactory.h" -#include "AUD_IIRFilterReader.h" -#include "AUD_HighpassCalculator.h" - -AUD_HighpassFactory::AUD_HighpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency, - float Q) : - AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_HighpassCalculator(frequency, Q))) -{ -} - diff --git a/intern/audaspace/FX/AUD_HighpassFactory.h b/intern/audaspace/FX/AUD_HighpassFactory.h deleted file mode 100644 index 56ced91c53c..00000000000 --- a/intern/audaspace/FX/AUD_HighpassFactory.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ***** 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/FX/AUD_HighpassFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_HIGHPASSFACTORY_H__ -#define __AUD_HIGHPASSFACTORY_H__ - -#include "AUD_DynamicIIRFilterFactory.h" - -/** - * This factory creates a highpass filter reader. - */ -class AUD_HighpassFactory : public AUD_DynamicIIRFilterFactory -{ -private: - // hide copy constructor and operator= - AUD_HighpassFactory(const AUD_HighpassFactory&); - AUD_HighpassFactory& operator=(const AUD_HighpassFactory&); - -public: - /** - * Creates a new highpass factory. - * \param factory The input factory. - * \param frequency The cutoff frequency. - * \param Q The Q factor. - */ - AUD_HighpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency, float Q = 1.0f); -}; - -#endif //__AUD_HIGHPASSFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_IDynamicIIRFilterCalculator.h b/intern/audaspace/FX/AUD_IDynamicIIRFilterCalculator.h deleted file mode 100644 index 2e0d8418571..00000000000 --- a/intern/audaspace/FX/AUD_IDynamicIIRFilterCalculator.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * ***** 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/FX/AUD_IDynamicIIRFilterCalculator.h - * \ingroup audfx - */ - -#ifndef AUD_IDYNAMICIIRFILTERCALCULATOR_H -#define AUD_IDYNAMICIIRFILTERCALCULATOR_H - -#include "AUD_Space.h" - -#include <vector> - -/** - * This interface calculates dynamic filter coefficients which depend on the - * sampling rate for AUD_DynamicIIRFilterReaders. - */ -class AUD_IDynamicIIRFilterCalculator -{ -public: - virtual ~AUD_IDynamicIIRFilterCalculator() {} - - /** - * Recalculates the filter coefficients. - * \param rate The sample rate of the audio data. - * \param[out] b The input filter coefficients. - * \param[out] a The output filter coefficients. - */ - virtual void recalculateCoefficients(AUD_SampleRate rate, - std::vector<float>& b, - std::vector<float>& a)=0; -}; - -#endif // AUD_IDYNAMICIIRFILTERCALCULATOR_H diff --git a/intern/audaspace/FX/AUD_IIRFilterFactory.cpp b/intern/audaspace/FX/AUD_IIRFilterFactory.cpp deleted file mode 100644 index c4f94a2dc27..00000000000 --- a/intern/audaspace/FX/AUD_IIRFilterFactory.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ***** 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/FX/AUD_IIRFilterFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_IIRFilterFactory.h" -#include "AUD_IIRFilterReader.h" - -AUD_IIRFilterFactory::AUD_IIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory, - std::vector<float> b, - std::vector<float> a) : - AUD_EffectFactory(factory), m_a(a), m_b(b) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_IIRFilterFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_IIRFilterReader(getReader(), m_b, m_a)); -} diff --git a/intern/audaspace/FX/AUD_IIRFilterFactory.h b/intern/audaspace/FX/AUD_IIRFilterFactory.h deleted file mode 100644 index 0b55c120384..00000000000 --- a/intern/audaspace/FX/AUD_IIRFilterFactory.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * ***** 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/FX/AUD_IIRFilterFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_IIRFILTERFACTORY_H__ -#define __AUD_IIRFILTERFACTORY_H__ - -#include "AUD_EffectFactory.h" -#include "AUD_IDynamicIIRFilterCalculator.h" - -#include <vector> - -/** - * This factory creates a IIR filter reader. - */ -class AUD_IIRFilterFactory : public AUD_EffectFactory -{ -private: - /** - * Output filter coefficients. - */ - std::vector<float> m_a; - - /** - * Input filter coefficients. - */ - std::vector<float> m_b; - - // hide copy constructor and operator= - AUD_IIRFilterFactory(const AUD_IIRFilterFactory&); - AUD_IIRFilterFactory& operator=(const AUD_IIRFilterFactory&); - -public: - /** - * Creates a new IIR filter factory. - * \param factory The input factory. - * \param b The input filter coefficients. - * \param a The output filter coefficients. - */ - AUD_IIRFilterFactory(boost::shared_ptr<AUD_IFactory> factory, std::vector<float> b, - std::vector<float> a); - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_IIRFILTERFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_IIRFilterReader.cpp b/intern/audaspace/FX/AUD_IIRFilterReader.cpp deleted file mode 100644 index 6716e6b9ddc..00000000000 --- a/intern/audaspace/FX/AUD_IIRFilterReader.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * ***** 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/FX/AUD_IIRFilterReader.cpp - * \ingroup audfx - */ - - -#include "AUD_IIRFilterReader.h" - -AUD_IIRFilterReader::AUD_IIRFilterReader(boost::shared_ptr<AUD_IReader> reader, - const std::vector<float>& b, - const std::vector<float>& a) : - AUD_BaseIIRFilterReader(reader, b.size(), a.size()), m_a(a), m_b(b) -{ - if(m_a.empty() == false) - { - for(int i = 1; i < m_a.size(); i++) - m_a[i] /= m_a[0]; - for(int i = 0; i < m_b.size(); i++) - m_b[i] /= m_a[0]; - m_a[0] = 1; - } -} - -sample_t AUD_IIRFilterReader::filter() -{ - sample_t out = 0; - - for(int i = 1; i < m_a.size(); i++) - out -= y(-i) * m_a[i]; - for(int i = 0; i < m_b.size(); i++) - out += x(-i) * m_b[i]; - - return out; -} - -void AUD_IIRFilterReader::setCoefficients(const std::vector<float>& b, - const std::vector<float>& a) -{ - setLengths(b.size(), a.size()); - m_a = a; - m_b = b; -} diff --git a/intern/audaspace/FX/AUD_IIRFilterReader.h b/intern/audaspace/FX/AUD_IIRFilterReader.h deleted file mode 100644 index d663805b50f..00000000000 --- a/intern/audaspace/FX/AUD_IIRFilterReader.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ***** 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/FX/AUD_IIRFilterReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_IIRFILTERREADER_H__ -#define __AUD_IIRFILTERREADER_H__ - -#include "AUD_BaseIIRFilterReader.h" - -#include <vector> - -/** - * This class is for infinite impulse response filters with simple coefficients. - */ -class AUD_IIRFilterReader : public AUD_BaseIIRFilterReader -{ -private: - /** - * Output filter coefficients. - */ - std::vector<float> m_a; - - /** - * Input filter coefficients. - */ - std::vector<float> m_b; - - // hide copy constructor and operator= - AUD_IIRFilterReader(const AUD_IIRFilterReader&); - AUD_IIRFilterReader& operator=(const AUD_IIRFilterReader&); - -public: - /** - * Creates a new IIR filter reader. - * \param reader The reader to read from. - * \param b The input filter coefficients. - * \param a The output filter coefficients. - */ - AUD_IIRFilterReader(boost::shared_ptr<AUD_IReader> reader, const std::vector<float>& b, - const std::vector<float>& a); - - virtual sample_t filter(); - - void setCoefficients(const std::vector<float>& b, - const std::vector<float>& a); -}; - -#endif //__AUD_IIRFILTERREADER_H__ diff --git a/intern/audaspace/FX/AUD_LimiterFactory.cpp b/intern/audaspace/FX/AUD_LimiterFactory.cpp deleted file mode 100644 index 679ed3a6b8b..00000000000 --- a/intern/audaspace/FX/AUD_LimiterFactory.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ***** 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/FX/AUD_LimiterFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_LimiterFactory.h" -#include "AUD_LimiterReader.h" -#include "AUD_Space.h" - -AUD_LimiterFactory::AUD_LimiterFactory(boost::shared_ptr<AUD_IFactory> factory, - float start, float end) : - AUD_EffectFactory(factory), - m_start(start), - m_end(end) -{ -} - -float AUD_LimiterFactory::getStart() const -{ - return m_start; -} - -float AUD_LimiterFactory::getEnd() const -{ - return m_end; -} - -boost::shared_ptr<AUD_IReader> AUD_LimiterFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_LimiterReader(getReader(), m_start, m_end)); -} diff --git a/intern/audaspace/FX/AUD_LimiterFactory.h b/intern/audaspace/FX/AUD_LimiterFactory.h deleted file mode 100644 index 0376952b4bd..00000000000 --- a/intern/audaspace/FX/AUD_LimiterFactory.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * ***** 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/FX/AUD_LimiterFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_LIMITERFACTORY_H__ -#define __AUD_LIMITERFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory limits another factory in start and end time. - */ -class AUD_LimiterFactory : public AUD_EffectFactory -{ -private: - /** - * The start time. - */ - const float m_start; - - /** - * The end time. - */ - const float m_end; - - // hide copy constructor and operator= - AUD_LimiterFactory(const AUD_LimiterFactory&); - AUD_LimiterFactory& operator=(const AUD_LimiterFactory&); - -public: - /** - * Creates a new limiter factory. - * \param factory The input factory. - * \param start The desired start time. - * \param end The desired end time, a negative value signals that it should - * play to the end. - */ - AUD_LimiterFactory(boost::shared_ptr<AUD_IFactory> factory, - float start = 0, float end = -1); - - /** - * Returns the start time. - */ - float getStart() const; - - /** - * Returns the end time. - */ - float getEnd() const; - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_LIMITERFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_LimiterReader.cpp b/intern/audaspace/FX/AUD_LimiterReader.cpp deleted file mode 100644 index 7d850ac7b5f..00000000000 --- a/intern/audaspace/FX/AUD_LimiterReader.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * ***** 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/FX/AUD_LimiterReader.cpp - * \ingroup audfx - */ - - -#include "AUD_LimiterReader.h" -#include "AUD_Buffer.h" - -AUD_LimiterReader::AUD_LimiterReader(boost::shared_ptr<AUD_IReader> reader, - float start, float end) : - AUD_EffectReader(reader), - m_start(start), - m_end(end) -{ - if(m_start > 0) - { - AUD_Specs specs = m_reader->getSpecs(); - AUD_Specs specs2; - - if(m_reader->isSeekable()) - m_reader->seek(m_start * specs.rate); - else - { - // skip first m_start samples by reading them - int length = AUD_DEFAULT_BUFFER_SIZE; - AUD_Buffer buffer(AUD_DEFAULT_BUFFER_SIZE * AUD_SAMPLE_SIZE(specs)); - bool eos = false; - for(int len = m_start * specs.rate; - length > 0 && !eos; - len -= length) - { - if(len < AUD_DEFAULT_BUFFER_SIZE) - length = len; - - m_reader->read(length, eos, buffer.getBuffer()); - - specs2 = m_reader->getSpecs(); - if(specs2.rate != specs.rate) - { - len = len * specs2.rate / specs.rate; - specs.rate = specs2.rate; - } - - if(specs2.channels != specs.channels) - { - specs = specs2; - buffer.assureSize(AUD_DEFAULT_BUFFER_SIZE * AUD_SAMPLE_SIZE(specs)); - } - } - } - } -} - -void AUD_LimiterReader::seek(int position) -{ - m_reader->seek(position + m_start * m_reader->getSpecs().rate); -} - -int AUD_LimiterReader::getLength() const -{ - int len = m_reader->getLength(); - AUD_SampleRate rate = m_reader->getSpecs().rate; - if(len < 0 || (len > m_end * rate && m_end >= 0)) - len = m_end * rate; - return len - m_start * rate; -} - -int AUD_LimiterReader::getPosition() const -{ - int pos = m_reader->getPosition(); - AUD_SampleRate rate = m_reader->getSpecs().rate; - return AUD_MIN(pos, m_end * rate) - m_start * rate; -} - -void AUD_LimiterReader::read(int& length, bool& eos, sample_t* buffer) -{ - eos = false; - if(m_end >= 0) - { - int position = m_reader->getPosition(); - AUD_SampleRate rate = m_reader->getSpecs().rate; - - if(position + length > m_end * rate) - { - length = m_end * rate - position; - eos = true; - } - - if(position < int(m_start * rate)) - { - int len2 = length; - for(int len = int(m_start * rate) - position; - len2 == length && !eos; - len -= length) - { - if(len < length) - len2 = len; - - m_reader->read(len2, eos, buffer); - position += len2; - } - - if(position < m_start * rate) - { - length = 0; - return; - } - } - - if(length < 0) - { - length = 0; - return; - } - } - if(eos) - { - m_reader->read(length, eos, buffer); - eos = true; - } - else - m_reader->read(length, eos, buffer); -} diff --git a/intern/audaspace/FX/AUD_LimiterReader.h b/intern/audaspace/FX/AUD_LimiterReader.h deleted file mode 100644 index 607eb9e5bec..00000000000 --- a/intern/audaspace/FX/AUD_LimiterReader.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * ***** 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/FX/AUD_LimiterReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_LIMITERREADER_H__ -#define __AUD_LIMITERREADER_H__ - -#include "AUD_EffectReader.h" - -/** - * This reader limits another reader in start and end times. - */ -class AUD_LimiterReader : public AUD_EffectReader -{ -private: - /** - * The start sample: inclusive. - */ - const float m_start; - - /** - * The end sample: exlusive. - */ - const float m_end; - - // hide copy constructor and operator= - AUD_LimiterReader(const AUD_LimiterReader&); - AUD_LimiterReader& operator=(const AUD_LimiterReader&); - -public: - /** - * Creates a new limiter reader. - * \param reader The reader to read from. - * \param start The desired start time (inclusive). - * \param end The desired end time (sample exklusive), a negative value - * signals that it should play to the end. - */ - AUD_LimiterReader(boost::shared_ptr<AUD_IReader> reader, float start = 0, float end = -1); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -#endif //__AUD_LIMITERREADER_H__ diff --git a/intern/audaspace/FX/AUD_LoopFactory.cpp b/intern/audaspace/FX/AUD_LoopFactory.cpp deleted file mode 100644 index a9e83e349a0..00000000000 --- a/intern/audaspace/FX/AUD_LoopFactory.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ***** 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/FX/AUD_LoopFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_LoopFactory.h" -#include "AUD_LoopReader.h" - -AUD_LoopFactory::AUD_LoopFactory(boost::shared_ptr<AUD_IFactory> factory, int loop) : - AUD_EffectFactory(factory), - m_loop(loop) -{ -} - -int AUD_LoopFactory::getLoop() const -{ - return m_loop; -} - -boost::shared_ptr<AUD_IReader> AUD_LoopFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_LoopReader(getReader(), m_loop)); -} diff --git a/intern/audaspace/FX/AUD_LoopFactory.h b/intern/audaspace/FX/AUD_LoopFactory.h deleted file mode 100644 index 570536bee9a..00000000000 --- a/intern/audaspace/FX/AUD_LoopFactory.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ***** 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/FX/AUD_LoopFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_LOOPFACTORY_H__ -#define __AUD_LOOPFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory loops another factory. - * \note The reader has to be seekable. - */ -class AUD_LoopFactory : public AUD_EffectFactory -{ -private: - /** - * The loop count. - */ - const int m_loop; - - // hide copy constructor and operator= - AUD_LoopFactory(const AUD_LoopFactory&); - AUD_LoopFactory& operator=(const AUD_LoopFactory&); - -public: - /** - * Creates a new loop factory. - * \param factory The input factory. - * \param loop The desired loop count, negative values result in endless - * looping. - */ - AUD_LoopFactory(boost::shared_ptr<AUD_IFactory> factory, int loop = -1); - - /** - * Returns the loop count. - */ - int getLoop() const; - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_LOOPFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_LoopReader.cpp b/intern/audaspace/FX/AUD_LoopReader.cpp deleted file mode 100644 index 6fbcaa5af37..00000000000 --- a/intern/audaspace/FX/AUD_LoopReader.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - * ***** 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/FX/AUD_LoopReader.cpp - * \ingroup audfx - */ - - -#include "AUD_LoopReader.h" -#include "AUD_Buffer.h" - -#include <cstring> - -AUD_LoopReader::AUD_LoopReader(boost::shared_ptr<AUD_IReader> reader, int loop) : - AUD_EffectReader(reader), m_count(loop), m_left(loop) -{ -} - -void AUD_LoopReader::seek(int position) -{ - int len = m_reader->getLength(); - if(len < 0) - m_reader->seek(position); - else - { - if(m_count >= 0) - { - m_left = m_count - (position / len); - if(m_left < 0) - m_left = 0; - } - m_reader->seek(position % len); - } -} - -int AUD_LoopReader::getLength() const -{ - if(m_count < 0) - return -1; - return m_reader->getLength() * m_count; -} - -int AUD_LoopReader::getPosition() const -{ - return m_reader->getPosition() * (m_count < 0 ? 1 : m_count); -} - -void AUD_LoopReader::read(int& length, bool& eos, sample_t* buffer) -{ - const AUD_Specs specs = m_reader->getSpecs(); - - int len = length; - - m_reader->read(length, eos, buffer); - - if(length < len && eos && m_left) - { - int pos = length; - length = len; - - while(pos < length && eos && m_left) - { - if(m_left > 0) - m_left--; - - m_reader->seek(0); - - len = length - pos; - m_reader->read(len, eos, buffer + pos * specs.channels); - - // prevent endless loop - if(!len) - break; - - pos += len; - } - - length = pos; - } -} diff --git a/intern/audaspace/FX/AUD_LoopReader.h b/intern/audaspace/FX/AUD_LoopReader.h deleted file mode 100644 index 12b8078b12d..00000000000 --- a/intern/audaspace/FX/AUD_LoopReader.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * ***** 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/FX/AUD_LoopReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_LOOPREADER_H__ -#define __AUD_LOOPREADER_H__ - -#include "AUD_EffectReader.h" -#include "AUD_Buffer.h" - -/** - * This class reads another reader and loops it. - * \note The other reader must be seekable. - */ -class AUD_LoopReader : public AUD_EffectReader -{ -private: - /** - * The loop count. - */ - const int m_count; - - /** - * The left loop count. - */ - int m_left; - - // hide copy constructor and operator= - AUD_LoopReader(const AUD_LoopReader&); - AUD_LoopReader& operator=(const AUD_LoopReader&); - -public: - /** - * Creates a new loop reader. - * \param reader The reader to read from. - * \param loop The desired loop count, negative values result in endless - * looping. - */ - AUD_LoopReader(boost::shared_ptr<AUD_IReader> reader, int loop); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -#endif //__AUD_LOOPREADER_H__ diff --git a/intern/audaspace/FX/AUD_LowpassCalculator.cpp b/intern/audaspace/FX/AUD_LowpassCalculator.cpp deleted file mode 100644 index 57452f09038..00000000000 --- a/intern/audaspace/FX/AUD_LowpassCalculator.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "AUD_LowpassCalculator.h" - -#include <cmath> - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -AUD_LowpassCalculator::AUD_LowpassCalculator(float frequency, float Q) : - m_frequency(frequency), - m_Q(Q) -{ -} - -void AUD_LowpassCalculator::recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a) -{ - float w0 = 2 * M_PI * m_frequency / rate; - float alpha = sin(w0) / (2 * m_Q); - float norm = 1 + alpha; - float c = cos(w0); - a.push_back(1); - a.push_back(-2 * c / norm); - a.push_back((1 - alpha) / norm); - b.push_back((1 - c) / (2 * norm)); - b.push_back((1 - c) / norm); - b.push_back(b[0]); -} diff --git a/intern/audaspace/FX/AUD_LowpassCalculator.h b/intern/audaspace/FX/AUD_LowpassCalculator.h deleted file mode 100644 index 18bb11feda7..00000000000 --- a/intern/audaspace/FX/AUD_LowpassCalculator.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef AUD_LOWPASSCALCULATOR_H -#define AUD_LOWPASSCALCULATOR_H - -#include "AUD_IDynamicIIRFilterCalculator.h" - -class AUD_LowpassCalculator : public AUD_IDynamicIIRFilterCalculator -{ -private: - /** - * The cutoff frequency. - */ - const float m_frequency; - - /** - * The Q factor. - */ - const float m_Q; - -public: - AUD_LowpassCalculator(float frequency, float Q); - - virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a); -}; - -#endif // AUD_LOWPASSCALCULATOR_H diff --git a/intern/audaspace/FX/AUD_LowpassFactory.cpp b/intern/audaspace/FX/AUD_LowpassFactory.cpp deleted file mode 100644 index bd225998392..00000000000 --- a/intern/audaspace/FX/AUD_LowpassFactory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * ***** 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/FX/AUD_LowpassFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_LowpassFactory.h" -#include "AUD_IIRFilterReader.h" -#include "AUD_LowpassCalculator.h" - -AUD_LowpassFactory::AUD_LowpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency, - float Q) : - AUD_DynamicIIRFilterFactory(factory, boost::shared_ptr<AUD_IDynamicIIRFilterCalculator>(new AUD_LowpassCalculator(frequency, Q))) -{ -} diff --git a/intern/audaspace/FX/AUD_LowpassFactory.h b/intern/audaspace/FX/AUD_LowpassFactory.h deleted file mode 100644 index dfd8ab35521..00000000000 --- a/intern/audaspace/FX/AUD_LowpassFactory.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ***** 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/FX/AUD_LowpassFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_LOWPASSFACTORY_H__ -#define __AUD_LOWPASSFACTORY_H__ - -#include "AUD_DynamicIIRFilterFactory.h" - -/** - * This factory creates a lowpass filter reader. - */ -class AUD_LowpassFactory : public AUD_DynamicIIRFilterFactory -{ -private: - // hide copy constructor and operator= - AUD_LowpassFactory(const AUD_LowpassFactory&); - AUD_LowpassFactory& operator=(const AUD_LowpassFactory&); - -public: - /** - * Creates a new lowpass factory. - * \param factory The input factory. - * \param frequency The cutoff frequency. - * \param Q The Q factor. - */ - AUD_LowpassFactory(boost::shared_ptr<AUD_IFactory> factory, float frequency, float Q = 1.0f); -}; - -#endif //__AUD_LOWPASSFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_PingPongFactory.cpp b/intern/audaspace/FX/AUD_PingPongFactory.cpp deleted file mode 100644 index 84e4b29415e..00000000000 --- a/intern/audaspace/FX/AUD_PingPongFactory.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * ***** 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/FX/AUD_PingPongFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_PingPongFactory.h" -#include "AUD_DoubleReader.h" -#include "AUD_ReverseFactory.h" - -AUD_PingPongFactory::AUD_PingPongFactory(boost::shared_ptr<AUD_IFactory> factory) : - AUD_EffectFactory(factory) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_PingPongFactory::createReader() -{ - boost::shared_ptr<AUD_IReader> reader = getReader(); - AUD_ReverseFactory factory(m_factory); - boost::shared_ptr<AUD_IReader> reader2 = factory.createReader(); - - return boost::shared_ptr<AUD_IReader>(new AUD_DoubleReader(reader, reader2)); -} diff --git a/intern/audaspace/FX/AUD_PingPongFactory.h b/intern/audaspace/FX/AUD_PingPongFactory.h deleted file mode 100644 index e8ee5c9e389..00000000000 --- a/intern/audaspace/FX/AUD_PingPongFactory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * ***** 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/FX/AUD_PingPongFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_PINGPONGFACTORY_H__ -#define __AUD_PINGPONGFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory plays another factory first normal, then reversed. - * \note Readers from the underlying factory must be reversable with seeking. - */ -class AUD_PingPongFactory : public AUD_EffectFactory -{ -private: - // hide copy constructor and operator= - AUD_PingPongFactory(const AUD_PingPongFactory&); - AUD_PingPongFactory& operator=(const AUD_PingPongFactory&); - -public: - /** - * Creates a new ping pong factory. - * \param factory The input factory. - */ - AUD_PingPongFactory(boost::shared_ptr<AUD_IFactory> factory); - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_PINGPONGFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_PitchFactory.cpp b/intern/audaspace/FX/AUD_PitchFactory.cpp deleted file mode 100644 index 9dc27a58162..00000000000 --- a/intern/audaspace/FX/AUD_PitchFactory.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ***** 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/FX/AUD_PitchFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_PitchFactory.h" -#include "AUD_PitchReader.h" -#include "AUD_Space.h" - -AUD_PitchFactory::AUD_PitchFactory(boost::shared_ptr<AUD_IFactory> factory, float pitch) : - AUD_EffectFactory(factory), - m_pitch(pitch) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_PitchFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_PitchReader(getReader(), m_pitch)); -} diff --git a/intern/audaspace/FX/AUD_PitchFactory.h b/intern/audaspace/FX/AUD_PitchFactory.h deleted file mode 100644 index 159388b28dd..00000000000 --- a/intern/audaspace/FX/AUD_PitchFactory.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * ***** 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/FX/AUD_PitchFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_PITCHFACTORY_H__ -#define __AUD_PITCHFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory changes the pitch of another factory. - */ -class AUD_PitchFactory : public AUD_EffectFactory -{ -private: - /** - * The pitch. - */ - const float m_pitch; - - // hide copy constructor and operator= - AUD_PitchFactory(const AUD_PitchFactory&); - AUD_PitchFactory& operator=(const AUD_PitchFactory&); - -public: - /** - * Creates a new pitch factory. - * \param factory The input factory. - * \param pitch The desired pitch. - */ - AUD_PitchFactory(boost::shared_ptr<AUD_IFactory> factory, float pitch); - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_PITCHFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_PitchReader.cpp b/intern/audaspace/FX/AUD_PitchReader.cpp deleted file mode 100644 index b3775c71a28..00000000000 --- a/intern/audaspace/FX/AUD_PitchReader.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ***** 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/FX/AUD_PitchReader.cpp - * \ingroup audfx - */ - - -#include "AUD_PitchReader.h" - -AUD_PitchReader::AUD_PitchReader(boost::shared_ptr<AUD_IReader> reader, float pitch) : - AUD_EffectReader(reader), m_pitch(pitch) -{ -} - -AUD_Specs AUD_PitchReader::getSpecs() const -{ - AUD_Specs specs = m_reader->getSpecs(); - specs.rate *= m_pitch; - return specs; -} - -float AUD_PitchReader::getPitch() const -{ - return m_pitch; -} - -void AUD_PitchReader::setPitch(float pitch) -{ - if(pitch <= 0) - pitch = 1; - m_pitch = pitch; -} diff --git a/intern/audaspace/FX/AUD_PitchReader.h b/intern/audaspace/FX/AUD_PitchReader.h deleted file mode 100644 index d22e589b05d..00000000000 --- a/intern/audaspace/FX/AUD_PitchReader.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ***** 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/FX/AUD_PitchReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_PITCHREADER_H__ -#define __AUD_PITCHREADER_H__ - -#include "AUD_EffectReader.h" - -/** - * This class reads another reader and changes it's pitch. - */ -class AUD_PitchReader : public AUD_EffectReader -{ -private: - /** - * The pitch level. - */ - float m_pitch; - - // hide copy constructor and operator= - AUD_PitchReader(const AUD_PitchReader&); - AUD_PitchReader& operator=(const AUD_PitchReader&); - -public: - /** - * Creates a new pitch reader. - * \param reader The reader to read from. - * \param pitch The pitch value. - */ - AUD_PitchReader(boost::shared_ptr<AUD_IReader> reader, float pitch); - - virtual AUD_Specs getSpecs() const; - - /** - * Retrieves the pitch. - * \return The current pitch value. - */ - float getPitch() const; - - /** - * Sets the pitch. - * \param pitch The new pitch value. - */ - void setPitch(float pitch); -}; - -#endif //__AUD_PITCHREADER_H__ diff --git a/intern/audaspace/FX/AUD_RectifyFactory.cpp b/intern/audaspace/FX/AUD_RectifyFactory.cpp deleted file mode 100644 index 26bb5615dad..00000000000 --- a/intern/audaspace/FX/AUD_RectifyFactory.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ***** 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/FX/AUD_RectifyFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_RectifyFactory.h" -#include "AUD_CallbackIIRFilterReader.h" - -#include <cmath> - -sample_t AUD_RectifyFactory::rectifyFilter(AUD_CallbackIIRFilterReader* reader, void* useless) -{ - return fabs(reader->x(0)); -} - -AUD_RectifyFactory::AUD_RectifyFactory(boost::shared_ptr<AUD_IFactory> factory) : - AUD_EffectFactory(factory) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_RectifyFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_CallbackIIRFilterReader(getReader(), 1, 1, rectifyFilter)); -} diff --git a/intern/audaspace/FX/AUD_RectifyFactory.h b/intern/audaspace/FX/AUD_RectifyFactory.h deleted file mode 100644 index eb595e43e4f..00000000000 --- a/intern/audaspace/FX/AUD_RectifyFactory.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ***** 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/FX/AUD_RectifyFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_RECTIFYFACTORY_H__ -#define __AUD_RECTIFYFACTORY_H__ - -#include "AUD_EffectFactory.h" -class AUD_CallbackIIRFilterReader; - -/** - * This factory rectifies another factory. - */ -class AUD_RectifyFactory : public AUD_EffectFactory -{ -private: - // hide copy constructor and operator= - AUD_RectifyFactory(const AUD_RectifyFactory&); - AUD_RectifyFactory& operator=(const AUD_RectifyFactory&); - -public: - /** - * Creates a new rectify factory. - * \param factory The input factory. - */ - AUD_RectifyFactory(boost::shared_ptr<AUD_IFactory> factory); - - virtual boost::shared_ptr<AUD_IReader> createReader(); - - static sample_t rectifyFilter(AUD_CallbackIIRFilterReader* reader, void* useless); -}; - -#endif //__AUD_RECTIFYFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_ReverseFactory.cpp b/intern/audaspace/FX/AUD_ReverseFactory.cpp deleted file mode 100644 index afb4ad2bec9..00000000000 --- a/intern/audaspace/FX/AUD_ReverseFactory.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * ***** 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/FX/AUD_ReverseFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_ReverseFactory.h" -#include "AUD_ReverseReader.h" -#include "AUD_Space.h" - -AUD_ReverseFactory::AUD_ReverseFactory(boost::shared_ptr<AUD_IFactory> factory) : - AUD_EffectFactory(factory) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_ReverseFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_ReverseReader(getReader())); -} diff --git a/intern/audaspace/FX/AUD_ReverseFactory.h b/intern/audaspace/FX/AUD_ReverseFactory.h deleted file mode 100644 index 5b0c9e3c29a..00000000000 --- a/intern/audaspace/FX/AUD_ReverseFactory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * ***** 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/FX/AUD_ReverseFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_REVERSEFACTORY_H__ -#define __AUD_REVERSEFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory reads another factory reverted. - * \note Readers from the underlying factory must be seekable. - */ -class AUD_ReverseFactory : public AUD_EffectFactory -{ -private: - // hide copy constructor and operator= - AUD_ReverseFactory(const AUD_ReverseFactory&); - AUD_ReverseFactory& operator=(const AUD_ReverseFactory&); - -public: - /** - * Creates a new reverse factory. - * \param factory The input factory. - */ - AUD_ReverseFactory(boost::shared_ptr<AUD_IFactory> factory); - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_REVERSEFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_ReverseReader.cpp b/intern/audaspace/FX/AUD_ReverseReader.cpp deleted file mode 100644 index c0a5962a299..00000000000 --- a/intern/audaspace/FX/AUD_ReverseReader.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * ***** 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/FX/AUD_ReverseReader.cpp - * \ingroup audfx - */ - - -#include "AUD_ReverseReader.h" - -#include <cstring> - -static const char* props_error = "AUD_ReverseReader: The reader has to be " - "seekable and a finite length."; - -AUD_ReverseReader::AUD_ReverseReader(boost::shared_ptr<AUD_IReader> reader) : - AUD_EffectReader(reader), - m_length(reader->getLength()), - m_position(0) -{ - if(m_length < 0 || !reader->isSeekable()) - AUD_THROW(AUD_ERROR_PROPS, props_error); -} - -void AUD_ReverseReader::seek(int position) -{ - m_position = position; -} - -int AUD_ReverseReader::getLength() const -{ - return m_length; -} - -int AUD_ReverseReader::getPosition() const -{ - return m_position; -} - -void AUD_ReverseReader::read(int& length, bool& eos, sample_t* buffer) -{ - // first correct the length - if(m_position + length > m_length) - length = m_length - m_position; - - if(length <= 0) - { - length = 0; - eos = true; - return; - } - - const AUD_Specs specs = getSpecs(); - const int samplesize = AUD_SAMPLE_SIZE(specs); - - sample_t temp[AUD_CHANNEL_MAX]; - - int len = length; - - // read from reader - m_reader->seek(m_length - m_position - len); - m_reader->read(len, eos, buffer); - - // set null if reader didn't give enough data - if(len < length) - memset(buffer, 0, (length - len) * samplesize); - - // copy the samples reverted - for(int i = 0; i < length / 2; i++) - { - memcpy(temp, - buffer + (len - 1 - i) * specs.channels, - samplesize); - memcpy(buffer + (len - 1 - i) * specs.channels, - buffer + i * specs.channels, - samplesize); - memcpy(buffer + i * specs.channels, - temp, - samplesize); - } - - m_position += length; - eos = false; -} diff --git a/intern/audaspace/FX/AUD_ReverseReader.h b/intern/audaspace/FX/AUD_ReverseReader.h deleted file mode 100644 index 219047915bd..00000000000 --- a/intern/audaspace/FX/AUD_ReverseReader.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * ***** 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/FX/AUD_ReverseReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_REVERSEREADER_H__ -#define __AUD_REVERSEREADER_H__ - -#include "AUD_EffectReader.h" -#include "AUD_Buffer.h" - -/** - * This class reads another reader from back to front. - * \note The underlying reader must be seekable. - */ -class AUD_ReverseReader : public AUD_EffectReader -{ -private: - /** - * The sample count. - */ - const int m_length; - - /** - * The current position. - */ - int m_position; - - // hide copy constructor and operator= - AUD_ReverseReader(const AUD_ReverseReader&); - AUD_ReverseReader& operator=(const AUD_ReverseReader&); - -public: - /** - * Creates a new reverse reader. - * \param reader The reader to read from. - * \exception AUD_Exception Thrown if the reader specified has an - * undeterminable/infinite length or is not seekable. - */ - AUD_ReverseReader(boost::shared_ptr<AUD_IReader> reader); - - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -#endif //__AUD_REVERSEREADER_H__ diff --git a/intern/audaspace/FX/AUD_SquareFactory.cpp b/intern/audaspace/FX/AUD_SquareFactory.cpp deleted file mode 100644 index 4b4dccb6e6b..00000000000 --- a/intern/audaspace/FX/AUD_SquareFactory.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ***** 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/FX/AUD_SquareFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_SquareFactory.h" -#include "AUD_CallbackIIRFilterReader.h" - -sample_t AUD_SquareFactory::squareFilter(AUD_CallbackIIRFilterReader* reader, float* threshold) -{ - float in = reader->x(0); - if(in >= *threshold) - return 1; - else if(in <= -*threshold) - return -1; - else - return 0; -} - -void AUD_SquareFactory::endSquareFilter(float* threshold) -{ - delete threshold; -} - -AUD_SquareFactory::AUD_SquareFactory(boost::shared_ptr<AUD_IFactory> factory, float threshold) : - AUD_EffectFactory(factory), - m_threshold(threshold) -{ -} - -float AUD_SquareFactory::getThreshold() const -{ - return m_threshold; -} - -boost::shared_ptr<AUD_IReader> AUD_SquareFactory::createReader() -{ - return boost::shared_ptr<AUD_IReader>(new AUD_CallbackIIRFilterReader(getReader(), 1, 1, - (doFilterIIR) squareFilter, - (endFilterIIR) endSquareFilter, - new float(m_threshold))); -} diff --git a/intern/audaspace/FX/AUD_SquareFactory.h b/intern/audaspace/FX/AUD_SquareFactory.h deleted file mode 100644 index 27e62b6f4cc..00000000000 --- a/intern/audaspace/FX/AUD_SquareFactory.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * ***** 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/FX/AUD_SquareFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_SQUAREFACTORY_H__ -#define __AUD_SQUAREFACTORY_H__ - -#include "AUD_EffectFactory.h" -class AUD_CallbackIIRFilterReader; - -/** - * This factory Transforms any signal to a square signal. - */ -class AUD_SquareFactory : public AUD_EffectFactory -{ -private: - /** - * The threshold. - */ - const float m_threshold; - - // hide copy constructor and operator= - AUD_SquareFactory(const AUD_SquareFactory&); - AUD_SquareFactory& operator=(const AUD_SquareFactory&); - -public: - /** - * Creates a new square factory. - * \param factory The input factory. - * \param threshold The threshold. - */ - AUD_SquareFactory(boost::shared_ptr<AUD_IFactory> factory, float threshold = 0.0f); - - /** - * Returns the threshold. - */ - float getThreshold() const; - - virtual boost::shared_ptr<AUD_IReader> createReader(); - - static sample_t squareFilter(AUD_CallbackIIRFilterReader* reader, float* threshold); - static void endSquareFilter(float* threshold); -}; - -#endif //__AUD_SQUAREFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_SumFactory.cpp b/intern/audaspace/FX/AUD_SumFactory.cpp deleted file mode 100644 index 7f82233a0b7..00000000000 --- a/intern/audaspace/FX/AUD_SumFactory.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ***** 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/FX/AUD_SumFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_SumFactory.h" -#include "AUD_IIRFilterReader.h" - -AUD_SumFactory::AUD_SumFactory(boost::shared_ptr<AUD_IFactory> factory) : - AUD_EffectFactory(factory) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_SumFactory::createReader() -{ - std::vector<float> a, b; - a.push_back(1); - a.push_back(-1); - b.push_back(1); - return boost::shared_ptr<AUD_IReader>(new AUD_IIRFilterReader(getReader(), b, a)); -} diff --git a/intern/audaspace/FX/AUD_SumFactory.h b/intern/audaspace/FX/AUD_SumFactory.h deleted file mode 100644 index a916f3509cb..00000000000 --- a/intern/audaspace/FX/AUD_SumFactory.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ***** 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/FX/AUD_SumFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_SUMFACTORY_H__ -#define __AUD_SUMFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory creates a sum reader. - */ -class AUD_SumFactory : public AUD_EffectFactory -{ -private: - // hide copy constructor and operator= - AUD_SumFactory(const AUD_SumFactory&); - AUD_SumFactory& operator=(const AUD_SumFactory&); - -public: - /** - * Creates a new sum factory. - * \param factory The input factory. - */ - AUD_SumFactory(boost::shared_ptr<AUD_IFactory> factory); - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_SUMFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_SuperposeFactory.cpp b/intern/audaspace/FX/AUD_SuperposeFactory.cpp deleted file mode 100644 index 3efad37a5b3..00000000000 --- a/intern/audaspace/FX/AUD_SuperposeFactory.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ***** 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/FX/AUD_SuperposeFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_SuperposeFactory.h" -#include "AUD_SuperposeReader.h" - -AUD_SuperposeFactory::AUD_SuperposeFactory(boost::shared_ptr<AUD_IFactory> factory1, boost::shared_ptr<AUD_IFactory> factory2) : - m_factory1(factory1), m_factory2(factory2) -{ -} - -boost::shared_ptr<AUD_IReader> AUD_SuperposeFactory::createReader() -{ - boost::shared_ptr<AUD_IReader> reader1 = m_factory1->createReader(); - boost::shared_ptr<AUD_IReader> reader2 = m_factory2->createReader(); - - return boost::shared_ptr<AUD_IReader>(new AUD_SuperposeReader(reader1, reader2)); -} diff --git a/intern/audaspace/FX/AUD_SuperposeFactory.h b/intern/audaspace/FX/AUD_SuperposeFactory.h deleted file mode 100644 index caa0dfb752f..00000000000 --- a/intern/audaspace/FX/AUD_SuperposeFactory.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ***** 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/FX/AUD_SuperposeFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_SUPERPOSEFACTORY_H__ -#define __AUD_SUPERPOSEFACTORY_H__ - -#include "AUD_IFactory.h" - -/** - * This factory mixes two other factories, playing them the same time. - * \note Readers from the underlying factories must have the same sample rate - * and channel count. - */ -class AUD_SuperposeFactory : public AUD_IFactory -{ -private: - /** - * First played factory. - */ - boost::shared_ptr<AUD_IFactory> m_factory1; - - /** - * Second played factory. - */ - boost::shared_ptr<AUD_IFactory> m_factory2; - - // hide copy constructor and operator= - AUD_SuperposeFactory(const AUD_SuperposeFactory&); - AUD_SuperposeFactory& operator=(const AUD_SuperposeFactory&); - -public: - /** - * Creates a new superpose factory. - * \param factory1 The first input factory. - * \param factory2 The second input factory. - */ - AUD_SuperposeFactory(boost::shared_ptr<AUD_IFactory> factory1, boost::shared_ptr<AUD_IFactory> factory2); - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_SUPERPOSEFACTORY_H__ diff --git a/intern/audaspace/FX/AUD_SuperposeReader.cpp b/intern/audaspace/FX/AUD_SuperposeReader.cpp deleted file mode 100644 index 294a48b3e7a..00000000000 --- a/intern/audaspace/FX/AUD_SuperposeReader.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * ***** 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/FX/AUD_SuperposeReader.cpp - * \ingroup audfx - */ - - -#include "AUD_SuperposeReader.h" - -#include <cstring> - -static const char* specs_error = "AUD_SuperposeReader: Both readers have to " - "have the same specs."; - -AUD_SuperposeReader::AUD_SuperposeReader(boost::shared_ptr<AUD_IReader> reader1, boost::shared_ptr<AUD_IReader> reader2) : - m_reader1(reader1), m_reader2(reader2) -{ -} - -AUD_SuperposeReader::~AUD_SuperposeReader() -{ -} - -bool AUD_SuperposeReader::isSeekable() const -{ - return m_reader1->isSeekable() && m_reader2->isSeekable(); -} - -void AUD_SuperposeReader::seek(int position) -{ - m_reader1->seek(position); - m_reader2->seek(position); -} - -int AUD_SuperposeReader::getLength() const -{ - int len1 = m_reader1->getLength(); - int len2 = m_reader2->getLength(); - if((len1 < 0) || (len2 < 0)) - return -1; - return AUD_MIN(len1, len2); -} - -int AUD_SuperposeReader::getPosition() const -{ - int pos1 = m_reader1->getPosition(); - int pos2 = m_reader2->getPosition(); - return AUD_MAX(pos1, pos2); -} - -AUD_Specs AUD_SuperposeReader::getSpecs() const -{ - return m_reader1->getSpecs(); -} - -void AUD_SuperposeReader::read(int& length, bool& eos, sample_t* buffer) -{ - AUD_Specs specs = m_reader1->getSpecs(); - AUD_Specs s2 = m_reader2->getSpecs(); - if(!AUD_COMPARE_SPECS(specs, s2)) - AUD_THROW(AUD_ERROR_SPECS, specs_error); - - int samplesize = AUD_SAMPLE_SIZE(specs); - - m_buffer.assureSize(length * samplesize); - - int len1 = length; - m_reader1->read(len1, eos, buffer); - - if(len1 < length) - memset(buffer + len1 * specs.channels, 0, (length - len1) * samplesize); - - int len2 = length; - bool eos2; - sample_t* buf = m_buffer.getBuffer(); - m_reader2->read(len2, eos2, buf); - - for(int i = 0; i < len2 * specs.channels; i++) - buffer[i] += buf[i]; - - length = AUD_MAX(len1, len2); - eos &= eos2; -} diff --git a/intern/audaspace/FX/AUD_SuperposeReader.h b/intern/audaspace/FX/AUD_SuperposeReader.h deleted file mode 100644 index a04ab90fe43..00000000000 --- a/intern/audaspace/FX/AUD_SuperposeReader.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***** 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/FX/AUD_SuperposeReader.h - * \ingroup audfx - */ - - -#ifndef __AUD_SUPERPOSEREADER_H__ -#define __AUD_SUPERPOSEREADER_H__ - -#include "AUD_IReader.h" -#include "AUD_Buffer.h" - -#include <boost/shared_ptr.hpp> - -/** - * This reader plays two readers with the same specs in parallel. - */ -class AUD_SuperposeReader : public AUD_IReader -{ -private: - /** - * The first reader. - */ - boost::shared_ptr<AUD_IReader> m_reader1; - - /** - * The second reader. - */ - boost::shared_ptr<AUD_IReader> m_reader2; - - /** - * Buffer used for mixing. - */ - AUD_Buffer m_buffer; - - // hide copy constructor and operator= - AUD_SuperposeReader(const AUD_SuperposeReader&); - AUD_SuperposeReader& operator=(const AUD_SuperposeReader&); - -public: - /** - * Creates a new superpose reader. - * \param reader1 The first reader to read from. - * \param reader2 The second reader to read from. - * \exception AUD_Exception Thrown if the specs from the readers differ. - */ - AUD_SuperposeReader(boost::shared_ptr<AUD_IReader> reader1, boost::shared_ptr<AUD_IReader> reader2); - - /** - * Destroys the reader. - */ - virtual ~AUD_SuperposeReader(); - - virtual bool isSeekable() const; - virtual void seek(int position); - virtual int getLength() const; - virtual int getPosition() const; - virtual AUD_Specs getSpecs() const; - virtual void read(int& length, bool& eos, sample_t* buffer); -}; - -#endif //__AUD_SUPERPOSEREADER_H__ diff --git a/intern/audaspace/FX/AUD_VolumeFactory.cpp b/intern/audaspace/FX/AUD_VolumeFactory.cpp deleted file mode 100644 index 4f0e1e425e6..00000000000 --- a/intern/audaspace/FX/AUD_VolumeFactory.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ***** 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/FX/AUD_VolumeFactory.cpp - * \ingroup audfx - */ - - -#include "AUD_VolumeFactory.h" -#include "AUD_IIRFilterReader.h" - -AUD_VolumeFactory::AUD_VolumeFactory(boost::shared_ptr<AUD_IFactory> factory, float volume) : - AUD_EffectFactory(factory), - m_volume(volume) -{ -} - -float AUD_VolumeFactory::getVolume() const -{ - return m_volume; -} - -boost::shared_ptr<AUD_IReader> AUD_VolumeFactory::createReader() -{ - std::vector<float> a, b; - a.push_back(1); - b.push_back(m_volume); - return boost::shared_ptr<AUD_IReader>(new AUD_IIRFilterReader(getReader(), b, a)); -} diff --git a/intern/audaspace/FX/AUD_VolumeFactory.h b/intern/audaspace/FX/AUD_VolumeFactory.h deleted file mode 100644 index 6fe779ffb88..00000000000 --- a/intern/audaspace/FX/AUD_VolumeFactory.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * ***** 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/FX/AUD_VolumeFactory.h - * \ingroup audfx - */ - - -#ifndef __AUD_VOLUMEFACTORY_H__ -#define __AUD_VOLUMEFACTORY_H__ - -#include "AUD_EffectFactory.h" - -/** - * This factory changes the volume of another factory. - * The set volume should be a value between 0.0 and 1.0, higher values at your - * own risk! - */ -class AUD_VolumeFactory : public AUD_EffectFactory -{ -private: - /** - * The volume. - */ - const float m_volume; - - // hide copy constructor and operator= - AUD_VolumeFactory(const AUD_VolumeFactory&); - AUD_VolumeFactory& operator=(const AUD_VolumeFactory&); - -public: - /** - * Creates a new volume factory. - * \param factory The input factory. - * \param volume The desired volume. - */ - AUD_VolumeFactory(boost::shared_ptr<AUD_IFactory> factory, float volume); - - /** - * Returns the volume. - * \return The current volume. - */ - float getVolume() const; - - virtual boost::shared_ptr<AUD_IReader> createReader(); -}; - -#endif //__AUD_VOLUMEFACTORY_H__ |