36 #ifndef DSPFILTERS_BUTTERWORTH_H
37 #define DSPFILTERS_BUTTERWORTH_H
43 #include "PoleFilter.h"
52 namespace Butterworth {
61 void design (
const int numPoles);
74 void design (
int numPoles,
double gainDb);
87 void setup (
int order,
89 double cutoffFrequency);
94 void setup (
int order,
96 double cutoffFrequency);
101 void setup (
int order,
103 double centerFrequency,
104 double widthFrequency);
109 void setup (
int order,
111 double centerFrequency,
112 double widthFrequency);
117 void setup (
int order,
119 double cutoffFrequency,
125 void setup (
int order,
127 double cutoffFrequency,
133 void setup (
int order,
135 double centerFrequency,
136 double widthFrequency,
146 template <
int MaxOrder>
151 template <
int MaxOrder>
156 template <
int MaxOrder>
161 template <
int MaxOrder>
166 template <
int MaxOrder>
171 template <
int MaxOrder>
176 template <
int MaxOrder>
196 static int getNumParams ()
203 return ParamInfo::defaultCutoffFrequencyParam ();
207 template <
class FilterClass>
210 void setParams (
const Params& params)
212 FilterClass::setup (
int(params[1]), params[0], params[2]);
223 static int getNumParams ()
230 return ParamInfo::defaultCenterFrequencyParam ();
235 return ParamInfo::defaultBandwidthHzParam ();
239 template <
class FilterClass>
242 void setParams (
const Params& params)
244 FilterClass::setup (
int(params[1]), params[0], params[2], params[3]);
255 static int getNumParams ()
262 return ParamInfo::defaultCutoffFrequencyParam ();
267 return ParamInfo::defaultGainParam ();
271 template <
class FilterClass>
274 void setParams (
const Params& params)
276 FilterClass::setup (
int(params[1]),
290 static int getNumParams ()
297 return ParamInfo::defaultCenterFrequencyParam ();
302 return ParamInfo::defaultBandwidthHzParam ();
307 return ParamInfo::defaultGainParam ();
311 template <
class FilterClass>
314 void setParams (
const Params& params)
316 FilterClass::setup (
int(params[1]), params[0], params[2], params[3], params[4]);
324 static Kind getKind () {
return kindLowPass; }
325 static const char* getName() {
return "Butterworth Low Pass"; }
330 static Kind getKind () {
return kindHighPass; }
331 static const char* getName() {
return "Butterworth High Pass"; }
336 static Kind getKind () {
return kindHighPass; }
337 static const char* getName() {
return "Butterworth Band Pass"; }
342 static Kind getKind () {
return kindHighPass; }
343 static const char* getName() {
return "Butterworth Band Stop"; }
348 static Kind getKind () {
return kindLowShelf; }
349 static const char* getName() {
return "Butterworth Low Shelf"; }
354 static Kind getKind () {
return kindHighShelf; }
355 static const char* getName() {
return "Butterworth High Shelf"; }
360 static Kind getKind () {
return kindBandShelf; }
361 static const char* getName() {
return "Butterworth Band Shelf"; }
365 template <
int MaxOrder,
366 template <
class>
class TypeClass,
367 template <
int>
class FilterClass>
372 return ParamInfo (idOrder,
"Order",
"Order",
374 &ParamInfo::Int_toControlValue,
375 &ParamInfo::Int_toNativeValue,
376 &ParamInfo::Int_toString);
387 template <
int MaxOrder>
393 template <
int MaxOrder>
399 template <
int MaxOrder>
405 template <
int MaxOrder>
411 template <
int MaxOrder>
417 template <
int MaxOrder>
423 template <
int MaxOrder>