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

allpass_halfband.h

Go to the documentation of this file.
00001 // 
00002 // author="Tony Kirke"
00003 // Copyright(c) 1993-1996 Tony Kirke
00004 /*
00005  * SPUC - Signal processing using C++ - A DSP library
00006  * 
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 */
00021 #ifndef ALLPASS_HALFBAND
00022 #define ALLPASS_HALFBAND
00023 #include "allpass_1.h"
00024 namespace SPUC {
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 template <class Numeric> class allpass_halfband
00051 {
00052  public:
00053   char even; 
00054  protected:   
00056   allpass_1<Numeric> A0,A1;
00058   Numeric out0,out1;
00059       
00060  public:
00061   allpass_halfband(Numeric c0, Numeric c1)
00062     : A0(c0,1), A1(c1,1) { even = 0;    }
00064   void reset() { A0.reset(); A1.reset(); out0=out1=0; }
00066   Numeric clock(Numeric input) {
00067         if (!even) {
00068                 out0 = A0.clock(input);
00069         } else {
00070                 out1 = A1.clock(input);
00071         }
00072         even = !even;
00073         if (even) return(0.5*(out0 + out1));
00074         else return(0.0); // to indicate that this sample is not calculated
00075         // Complimentary filter return(0.5*(out0 - out1));
00076         }
00077 };     
00078 } // namespace SPUC 
00079 #endif

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