// file: csnr_gp_1.cc // // this is the function that checks the validity of the command line arguments // // system include file // #include // local include file // #include "global_constants.h" #include "calculate_snr_constants.h" #include "calculate_snr.h" // function: check_parameters_cc // // arguments: // char* datafile_a: (input) file that contains the signal // float frame_size_a: (input) duration of frame // float window_size_a: (input) duration of window // float sample_freq_a: (input) sample frequency // int num_chans_a: (input) number of channels // float noise_threshold_a: (output) threshold of noise // float signal_threshold_a: (output) threshold of signal+noise // int debug_mode_a: (input) debug mode // // return: an int to indicate status // // this function parses the command line arguments // // int check_parameters_cc (char* datafile_a, float frame_size_a, float window_size_a, float sample_freq_a, int num_chans_a, float noise_threshold_a, float signal_threshold_a, int debug_mode_a) { if ( (frame_size_a <= 0) || (window_size_a <= 0) || (sample_freq_a <= 0) || (num_chans_a <= 0) || (noise_threshold_a < 0) || (signal_threshold_a < 0) || (debug_mode_a < 0) ) { fprintf(stdout, "Error: Parameter value is negative\n"); return FALSE; } if (window_size_a < frame_size_a) { fprintf(stdout, "Warning: Window size < frame size\n"); // return FALSE; } if (debug_mode_a > DEBUG_FULL) { fprintf(stdout, "signal file: %s\n", datafile_a); fprintf(stdout, "frame size: %.2f\n", frame_size_a); fprintf(stdout, "window size: %.2f\n", window_size_a); fprintf(stdout, "sample frequency: %.2f\n", sample_freq_a); fprintf(stdout, "number of channels: %d\n", num_chans_a); fprintf(stdout, "noise threshold: %.2f\n", noise_threshold_a); fprintf(stdout, "signal threshold: %.2f\n", signal_threshold_a); } // exit gracefully // return TRUE; }