// file: fbc_filter.C // // Apply filter to frame of data. // #include "fbc.h" int fbc_filter_C(float* buffer_out, float frame_dur_samples, float* filtered_frame, float a1, float a2, float b1, float b2, float& yn1, float& yn2, float& xn1, float& xn2, float& a1_prev, float& a2_prev, float& b1_prev, float& b2_prev, int frame_number) { // Main Filter // // For the first frame, set the previous coef to the current one to // prevent a spike in the first frame. // if (frame_number == 0){ a1_prev = a1; a2_prev = a2; b1_prev = b1; b2_prev = b2; } // initialize temp variables for approximations // float a1_current = 0.0; float a2_current = 0.0; float b1_current = 0.0; float b2_current = 0.0; float gain; gain = (1+a1+a2)/(1+b1+b2); for (int n = 0; n