00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef BANDFILTER_H
00020 #define BANDFILTER_H
00021
00022 #include "Typedefs.h"
00023 #include "Debug.h"
00024
00025 #include "Filter.h"
00026 #include "FilterUtils.h"
00027
00075 class BandFilter {
00076 public:
00083 enum FilterType {
00084 CHEBYSHEVI = 0 ,
00085 CHEBYSHEVII = 1 ,
00086 BUTTERWORTH = 2 ,
00087 BESSEL = 3
00088 };
00089
00096 enum BandType {
00097 LOWPASS = 0 ,
00098 HIGHPASS = 1 ,
00099 BANDPASS = 2 ,
00100 BANDSTOP = 3
00101 };
00102
00103 protected:
00104 int _order;
00105 Real _lowFrequency;
00106 Real _highFrequency;
00107 Real _passRipple;
00108 Real _stopAttenuation;
00109 int _channelCount;
00110
00111 Filter _filter;
00112
00113 FilterType _filterType;
00114 BandType _bandType;
00115
00116 public:
00122 BandFilter(int order = 4, Real lowFrequency = 0.0, Real highFrequency = 1.0, BandType bandType = LOWPASS, FilterType filterType = CHEBYSHEVII, Real ripplePass = 0.05, Real attenuationStop = 40.0);
00123
00124 void setup();
00125 void reset();
00126
00142 void process( const MatrixXR& samples, MatrixXR* filtered );
00143
00149 void a( MatrixXR* a ) const;
00150
00156 void b( MatrixXR* b ) const;
00157
00164 int order() const;
00165
00173 void setOrder( int order, bool callSetup = true );
00174
00181 Real lowFrequency() const;
00182
00189 void setLowFrequency( Real frequency, bool callSetup = true );
00190
00197 Real highFrequency() const;
00198
00205 void setHighFrequency( Real frequency, bool callSetup = true );
00206
00214 FilterType filterType() const;
00215
00221 void setFilterType( FilterType type, bool callSetup = true );
00222
00230 BandType bandType() const;
00231
00237 void setBandType( BandType type, bool callSetup = true );
00238
00248 Real passRipple() const;
00249
00258 void setPassRipple( Real rippleDB, bool callSetup = true );
00259
00269 Real stopAttenuation() const;
00270
00279 void setStopAttenuation( Real attenuationDB, bool callSetup = true );
00280 };
00281
00282 #endif