// file: fbc_get_0.C // #include "fbc.h" // define the command line options char *options[] = { "-p", // parameter file not used "-o", // output file "-i", // input file "-s", // sampling rate used "-n", // number of fft points used "-f", // duration of frames to be processed "-w", // duration of window "\0", // end of line, null }; //----------------------------------------------------------------------------- // function: fbc_get_0_C // // arguments: // char* output_file: (output) output filename // char* input_file: (output) input filename // int argc: (input) number of command line arguments // char** argv: (input) command line arguments // // returns: // L_TRUE if no error was encounterd //----------------------------------------------------------------------------- int fbc_get_0_C(char* output_file, char* input_file, float& sample_frequency, int& fft_num, float& frame_duration, float& window_duration, int argc, char** argv) { // declare local variables // int opt_index = 0; // loop over options, decoding each one // while (*options[opt_index] != NULL) { // loop over command line options // increment counters by 2 (skipping over value) // for (int arg_index=1; arg_index<(argc-(int)1); arg_index+=2) { // check for a partial match // if (strstr(options[opt_index], argv[arg_index]) != NULL) { // assign options - this is bad code! it is too hardcoded! // /* if (opt_index == (int)0) {strcpy(param_file, argv[arg_index+1]);} */ if (opt_index == (int)1) {strcpy(output_file, argv[arg_index+1]);} else if (opt_index == (int)2) {strcpy(input_file, argv[arg_index+1]);} else if (opt_index == (int)3) {sample_frequency = atof(argv[arg_index+1]);} else if (opt_index == (int)4) {fft_num = atoi(argv[arg_index+1]);} else if (opt_index == (int)5) {frame_duration = atof(argv[arg_index+1]);} else if (opt_index == (int)6) {window_duration = atof(argv[arg_index+1]);} } } // increment counters // opt_index++; } // exit gracefully // return L_TRUE; }