Blender V2.61 - r43446

AUD_BaseIIRFilterReader.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * Copyright 2009-2011 Jörg Hermann Müller
00005  *
00006  * This file is part of AudaSpace.
00007  *
00008  * Audaspace is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * AudaSpace is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with Audaspace; if not, write to the Free Software Foundation,
00020  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021  *
00022  * ***** END GPL LICENSE BLOCK *****
00023  */
00024 
00030 #ifndef AUD_BASEIIRFILTERREADER
00031 #define AUD_BASEIIRFILTERREADER
00032 
00033 #include "AUD_EffectReader.h"
00034 #include "AUD_Buffer.h"
00035 
00039 class AUD_BaseIIRFilterReader : public AUD_EffectReader
00040 {
00041 private:
00045     AUD_Specs m_specs;
00046 
00050     int m_xlen;
00051 
00055     int m_ylen;
00056 
00060     sample_t* m_x;
00061 
00065     sample_t* m_y;
00066 
00070     int m_xpos;
00071 
00075     int m_ypos;
00076 
00080     int m_channel;
00081 
00082     // hide copy constructor and operator=
00083     AUD_BaseIIRFilterReader(const AUD_BaseIIRFilterReader&);
00084     AUD_BaseIIRFilterReader& operator=(const AUD_BaseIIRFilterReader&);
00085 
00086 protected:
00093     AUD_BaseIIRFilterReader(AUD_Reference<AUD_IReader> reader, int in, int out);
00094 
00095     void setLengths(int in, int out);
00096 
00097 public:
00103     inline sample_t x(int pos)
00104     {
00105         return m_x[(m_xpos + pos + m_xlen) % m_xlen * m_specs.channels + m_channel];
00106     }
00107 
00113     inline sample_t y(int pos)
00114     {
00115         return m_y[(m_ypos + pos + m_ylen) % m_ylen * m_specs.channels + m_channel];
00116     }
00117 
00118     virtual ~AUD_BaseIIRFilterReader();
00119 
00120     virtual void read(int& length, bool& eos, sample_t* buffer);
00121 
00126     virtual sample_t filter()=0;
00127 
00132     virtual void sampleRateChanged(AUD_SampleRate rate);
00133 };
00134 
00135 #endif //AUD_BASEIIRFILTERREADER