Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

allpass_1.h

Go to the documentation of this file.
00001 #ifndef ALLPASS_1
00002 #define ALLPASS_1
00003 #include <delay.h>
00004 // 
00005 // author="Tony Kirke"
00006 // Copyright(c) 1993-1996 Tony Kirke
00007 /*
00008  * SPUC - Signal processing using C++ - A DSP library
00009  * 
00010  * This program 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, or (at your option)
00013  * any later version.
00014  * 
00015  * This program 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 this program; if not, write to the Free Software
00022  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023 */
00024 namespace SPUC {
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 template <class Numeric> class allpass_1
00040 {
00041  protected:  
00043   long size; 
00044   Numeric gain;
00045   delay<Numeric> mult;
00046   delay<Numeric> sum;
00047         
00048  public:
00050   allpass_1(Numeric Gain=0, long s=1) { 
00051     gain = Gain;
00052     size = s;
00053     mult.set_size(size);
00054     sum.set_size(size);
00055   }
00057   void reset() {
00058           mult.reset();
00059           sum.reset();
00060   }
00062   void init(Numeric Gain, long s) { 
00063   gain = Gain;
00064   size = s;
00065   mult.set_size(size);
00066   sum.set_size(size);
00067 }
00069 Numeric clock(Numeric input) {
00070         Numeric current_sum, current_mult,out;
00071         
00072         out = sum.check(size-1);
00073         current_sum = input + mult.check(size-1);
00074         current_mult = -gain*current_sum;
00075         out -= current_mult;
00076         // update delay lines
00077         mult.input(current_mult);
00078         sum.input(current_sum);
00079         return(out);
00080         }
00081 };                                               
00082 } // namespace SPUC 
00083 #endif

Generated on Fri Sep 16 11:02:25 2005 for spuc by  doxygen 1.4.4