Biquad filter library in C++ template form. On mbed LPC1768, can run about 100K operations per second with double precision float, or about 200K with single precision float.
Diff: biquad.h
- Revision:
- 2:9a9b643fcc66
- Parent:
- 1:9c0546cd518e
- Child:
- 3:abd20f34fd68
--- a/biquad.h Tue Feb 14 23:23:42 2012 +0000 +++ b/biquad.h Wed Feb 15 18:12:50 2012 +0000 @@ -12,6 +12,9 @@ * */ +#ifndef __BIQUAD_H_ +#define __BIQUAD_H_ + #include <math.h> #ifndef M_LN2 @@ -43,7 +46,7 @@ T srate, /* sampling rate */ T bandwidth); /* bandwidth in octaves */ - void Reset(BIQUAD_FILTER_TYPE type, T dbGain, T freq, T srate, T bandwidth); + void Reset(BIQUAD_FILTER_TYPE type, T dbGain, T freq, T srate, T bandwidth, bool clearHistory = false); T Calculate(T sample); @@ -51,3 +54,6 @@ T x1, x2, y1, y2; }; + +#endif +