void ProcessBuffer() /////////////////////////////////////////////////////////////////////// // Purpose: Processes the data in buffer[ready_index] and stores // the results back into the buffer // // Input: None // // Returns: Nothing // // Calls: Nothing // // Notes: None /////////////////////////////////////////////////////////////////////// { Uint32 i; volatile float *pL = buffer[ready_index][LEFT]; // volatile float *pR = buffer[ready_index][RIGHT]; static int frame_count = 0; /* copy left channel to complex array */ for(i=0;i < BUFFER_LENGTH;i++){ x[i].real = *pL++; x[i].imag = 0; } /* calculate the FFT of x[N] */ fft_c(N, x, W); /* get magnitude of complex array */ for(i=0;i < BUFFER_LENGTH;i++){ y[i] = sqrtf(x[i].real*x[i].real + x[i].imag*x[i].imag); } if(frame_count++ > 0) { frame_count = 0; // put probe point here } buffer_ready = 0; }
void ZeroBuffers() //////////////////////////////////////////////////////////////////////// // Purpose: Sets all buffer locations to 0 // // Input: None // // Returns: Nothing // // Calls: Nothing // // Notes: None /////////////////////////////////////////////////////////////////////// { Int32 i = BUFFER_COUNT * NUM_BUFFERS; Int32 *p = (Int32 *)buffer; while(i--) *p++ = 0; init_W(N, W); init_W_neg(N, WN); padToN(B, N_coeff + 1); for(i = 0; i < N; i++) { coeffs[i].real = B_pad[i]; coeffs[i].imag = 0.0f; } for(i = 0; i < (N - BUFFER_COUNT); i++) { saved[i] = 0; } fft_c(N, coeffs, W); }
void fft_execute(struct fft_desc_t * desc, struct complex_t * signal) { fft_c(desc->size, signal, desc->W); }
void fft(struct fft_desc_t * desc, struct complex_t * data) { fft_c(desc->size, data, desc->W); }