Blender  V2.59
AUD_BaseIIRFilterReader.h
Go to the documentation of this file.
00001 /*
00002  * $Id: AUD_BaseIIRFilterReader.h 35141 2011-02-25 10:21:56Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * Copyright 2009-2011 Jörg Hermann Müller
00007  *
00008  * This file is part of AudaSpace.
00009  *
00010  * Audaspace is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * AudaSpace is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with Audaspace; if not, write to the Free Software Foundation,
00022  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00023  *
00024  * ***** END GPL LICENSE BLOCK *****
00025  */
00026 
00032 #ifndef AUD_BASEIIRFILTERREADER
00033 #define AUD_BASEIIRFILTERREADER
00034 
00035 #include "AUD_EffectReader.h"
00036 #include "AUD_Buffer.h"
00037 
00041 class AUD_BaseIIRFilterReader : public AUD_EffectReader
00042 {
00043 private:
00047         const int m_channels;
00048 
00052         const int m_xlen;
00053 
00057         const int m_ylen;
00058 
00062         AUD_Buffer m_buffer;
00063 
00067         sample_t* m_x;
00068 
00072         sample_t* m_y;
00073 
00077         int m_xpos;
00078 
00082         int m_ypos;
00083 
00087         int m_channel;
00088 
00089         // hide copy constructor and operator=
00090         AUD_BaseIIRFilterReader(const AUD_BaseIIRFilterReader&);
00091         AUD_BaseIIRFilterReader& operator=(const AUD_BaseIIRFilterReader&);
00092 
00093 protected:
00100         AUD_BaseIIRFilterReader(AUD_IReader* reader, int in, int out);
00101 
00102 public:
00103         inline sample_t x(int pos)
00104         {
00105                 return m_x[(m_xpos + pos + m_xlen) % m_xlen * m_channels + m_channel];
00106         }
00107 
00108         inline sample_t y(int pos)
00109         {
00110                 return m_y[(m_ypos + pos + m_ylen) % m_ylen * m_channels + m_channel];
00111         }
00112 
00113         virtual ~AUD_BaseIIRFilterReader();
00114 
00115         virtual void read(int & length, sample_t* & buffer);
00116 
00117         virtual sample_t filter()=0;
00118 };
00119 
00120 #endif //AUD_BASEIIRFILTERREADER