// file: csnr_cal_5.cc // // this function calculates the energy of the signal // // system include file // #include // local include file // #include "global_constants.h" #include "calculate_snr_constants.h" #include "calculate_snr.h" // function: add_energy_cc // // arguments: // float**& energy_buffer_a: (output) buffer containing the energy of // each frame // int& num_energy_vals_a: (input/output) number of energy points in // the buffer // float* energy_window_a: (input) energy to be added to buffer // int num_chans_a: (input) number of channels // int debug_mode_a: (input) debug mode // // return: an int to indicate status // // this function calculates the energy of a signal // // int add_energy_cc (float**& energy_buffer_a, int& num_energy_vals_a, float* energy_window_a, int num_chans_a, int debug_mode_a) { for (int j = 0; j < num_chans_a; j++) { energy_buffer_a[j][num_energy_vals_a] = energy_window_a[j]; } if (debug_mode_a > DEBUG_FULL) { for (int j = 0; j < num_chans_a; j++) { fprintf(stdout, "energy value [%d] = %.2f\n", num_energy_vals_a, energy_window_a[j]); } fprintf(stdout, "\n"); } num_energy_vals_a++; // exit gracefully // return TRUE; }