// file: csnr_cal_8.cc // // this function finds the end sample in the file // // system include file // #include // local include file // #include "global_constants.h" #include "calculate_snr_constants.h" #include "calculate_snr.h" // function: calculate_end_sample_cc // // arguments: // char* input_file_a: (input) name of input file // float sample_freq_a: (input) sample frequency // int num_chans_a: (input) number of channels // // return: the end time of the file // // this function finds the end sample in the file // // int calculate_end_sample_cc (char* input_file_a, float sample_freq_a, int num_chans_a) { // open the file // FILE* fp = fopen (input_file_a, "r"); // rewind the file to the beginning of the file // rewind(fp); // compute the length of file in bytes // fseek(fp, 0, SEEK_END); int total_bytes = ftell(fp); // return number of frames in the file // return (int (total_bytes / (num_chans_a * CSNR_BYTES_PER_SAMPLE)) ); }