00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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);
00075
00076 }
00077 };
00078 }
00079 #endif