//Band pass resonator order=1 alpha1=0.01 class filter { public: filter() { for(int i=0; i <= 2; i++) v[i]=0; } private: short v[3]; public: short step(short x) { v[0] = v[1]; v[1] = v[2]; long tmp = ((((x * 31928L) >> 6) //= ( 3.0449316288e-2 * x) + (v[0] * -15386L) //+( -0.9391013674*v[0]) + (v[1] * 31708L) //+( 1.9352749938*v[1]) )+8192) >> 14; // round and downshift fixed point /16384 v[2]= (short)tmp; return (short)(( (v[2] - v[0]))); // 2^ } };