// file: fbc_detect2.C // // Detect feedback in frame of data. // #include "fbc.h" int fbc_detect2_C (double* fft_out, float threshold_const2, float bandwidth, float* center_freq2, float* max2, int fft_num, float sample_frequency, int& num_maximums2, int frame_number) { // Declare local variable for the magnitude of the fft // double* fft_mag = (double*)malloc(fft_num/2 * sizeof(double)); // Compute the magnitude of the fft, // The fft is in real and imaginary parts, 0: real 1: imaginaries, 2: // 3: imaginary, ... 2*k are reals, 2*k+1 are imaginaries. // for (int k = 0; k threshold) { max2[num_maximums2] = fft_mag[current_sample_num]; position_of_cf[num_maximums2] = current_sample_num; num_maximums2 = num_maximums2 + 1; } } // Determine center frequency of each maximum sample // for (int current_center_freq=0; current_center_freq