11 #define IIR_FILTER_STAGE_COEFFICIENTS (5)
12 #define IIR_FILTER_STAGE_STATES (IIR_FILTER_STAGE_COEFFICIENTS - 1)
17 double coefficients[IIR_FILTER_STAGE_COEFFICIENTS];
18 double states[IIR_FILTER_STAGE_STATES];
21 void setCoefficients(
double* newCoefficients);
22 void setStates(
double* newStates);
24 double process(
double in){
29 void process(
double* inout,
int length){
31 double b0=coefficients[0];
32 double b1=coefficients[1];
33 double b2=coefficients[2];
34 double a1=coefficients[3];
35 double a2=coefficients[4];
36 double x1 = states[0];
38 double y1 = states[2];
39 double y2 = states[3];
40 for(
int n = 0; n < length; n++){
42 double y = x0 * b0 + x1 * b1 + x2 * b2 +
60 int numberOfStages = 0;
65 IirFilter(
int newNumberOfStages,
double *newCoefficients);
66 void setCoefficients(
double* newCoefficients);
67 void setCoefficients(
double* newCoefficients,
unsigned int stage);
68 void setStates(
double* newStates);
69 void setStates(
double* newStates,
unsigned int stage);
70 void setNumberOfStages(
int newNumberOfStages);
74 double process(
double in){
78 void process(
double* inout,
int length){
79 for(
int n = 0; n < numberOfStages && n < 8; n++){
80 stages[n]->process(inout, length);
Definition: IirFilter.h:57
Definition: IirFilter.h:14