18 #include "Properties.h"
20 extern bool globWarningFlag;
21 extern bool globReportFlag;
34 post(
"Air filter cutoff capped at 500.");
36 else if (newCutOff > (
long) Properties::SAMPLERATE * 0.44)
38 newCutOff = (long) Properties::SAMPLERATE * 0.44;
40 post(
"Air filter cutoff capped at %f.", Properties::SAMPLERATE * 0.44);
49 double l, al, bl2, rcp;
50 double tempa0, tempa1, tempa2, tempb1, tempb2;
58 post(
"l capped at %f", l);
60 else if (l > 1.57079632)
64 post(
"l capped at %f", l);
75 rcp = 1.0 / (al + bl2);
80 tempb1 = rcp * 2.0 * (bl2 - 2.0);
81 tempb2 = rcp * (al - bl2);
87 double discriminant = tempb1 * tempb1 + 4.0 * tempb2;
88 if (tempb1 <= -1.9999996)
90 else if (tempb1 >= 1.9999996)
93 if (tempb2 <= -0.9999998)
95 else if (tempb2 >= 0.9999998)
98 if (discriminant >= 0.0)
100 if (0.9999998 - tempb1 - tempb2 < 0.0)
101 tempb2 = 0.9999998 - tempb1;
102 if (0.9999998 + tempb1 - tempb2 < 0.0)
103 tempb2 = 0.9999998 + tempb1;
115 post(
"b1: %f, b2: %f, a0: %f, a1: %f, a2: %f, cutoff: %f",
b1_,
b2_,
a0_,
a1_,
a2_, cutOff_);
void cutOff(long newCutOff)
Set cutoff frequency.
double a2_
Filter coefficient.
double sr_
Pi divided by the sample rate.
LowPass()
Class constructor.
double b1_
Filter coefficient.
double b2_
Filter coefficient.
double a1_
Filter coefficient.
double a0_
Filter coefficient.
virtual void print() const
Print out info about this filter.