#include #include #include #include "util.h" #include "globals.h" #include "load.h" using namespace std; void show_help() { cout << "TODO: help text" << endl; } void show_version() { cout << "TODO: softsynth version foo" << endl; } void parse_args(int argc, char** argv) { static const struct option long_options[]={ {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, {"verbose", no_argument, 0, 'v'}, {"quiet", no_argument, 0, 'q'}, {"fatal-warnings", no_argument, 0, 'F'}, {"frameskip", required_argument, 0, 'f'}, {"xruns", required_argument, 0, 'x'}, {"dir", required_argument, 0, 'd'}, {"directory", required_argument, 0, 'd'}, {"program", required_argument, 0, 'p'}, {"cleanup-interval", required_argument, 0, 'i'}, {"lfo0-freq", required_argument, 0, 400}, //FINDLFO {"lfo1-freq", required_argument, 0, 401}, {"lfo2-freq", required_argument, 0, 402}, {"snh-freq", required_argument, 0, 304}, {"sample-and-hold-freq", required_argument, 0, 304}, {"conf", required_argument, 0, 'c'}, {"config", required_argument, 0, 'c'}, {"max-port", required_argument, 0, 303}, {"max-port-time", required_argument, 0, 303}, {"max-portamento-time", required_argument, 0, 303}, {"filter-update-freq", required_argument, 0, 305}, {"lfo-update-freq", required_argument, 0, 306}, {"env-update-freq", required_argument, 0, 307}, {"envelope-update-freq", required_argument, 0, 307}, {"no-connect-audio-out", no_argument, 0, 'a'}, {"no-connect-audio", no_argument, 0, 'a'}, {"dont-connect-audio-out", no_argument, 0, 'a'}, {"dont-connect-audio", no_argument, 0, 'a'}, {"no-connect-midi-in", no_argument, 0, 'm'}, {"no-connect-midi", no_argument, 0, 'm'}, {"dont-connect-midi-in", no_argument, 0, 'm'}, {"dont-connect-midi", no_argument, 0, 'm'}, 0 }; while (optind=0) && (num<=127)) { if (programfile[num]=="") programfile[num]=str.substr(pos+1); else output_note("NOTE: program #"+IntToStr(num)+" has already been defined. ignoring it..."); } else { output_warning("WARNING: number out of range (0..127) in --program option.\n ignoring the option..."); } } else { output_warning("WARNING: not a number in --program option. ignoring the option..."); } } else { output_warning("WARNING: missing number in --program option. ignoring the option..."); } } break; case 'i': if (isfloat(optarg)) cleanup_interval_sec=atof(optarg); else output_warning("WARNING: not a number in --interval option. ignoring it..."); break; case 304: if (isfloat(optarg)) snh_freq_hz=atof(optarg); else output_warning("WARNING: not a number in --sample-and-hold-freq option. ignoring it..."); break; case 400: //FINDLFO case 401: case 402: if (isfloat(optarg)) lfo_freq_hz[result-400]=atof(optarg); else output_warning("WARNING: not a number in --lfoN-freq option. ignoring it..."); break; case 303: if (isfloat(optarg)) max_port_time_sec=atof(optarg); else output_warning("WARNING: not a number in --max-portamento-time option. ignoring it..."); break; case 305: if (isfloat(optarg)) if (atoi(optarg)<=0) output_warning("WARNING: filter-update-freq must be positive. ignoring it..."); else filter_update_freq_hz=atof(optarg); else output_warning("WARNING: not a number in --filter-update-freq option. ignoring it..."); break; case 306: if (isfloat(optarg)) if (atoi(optarg)<=0) output_warning("WARNING: lfo-update-freq must be positive. ignoring it..."); else lfo_update_freq_hz=atof(optarg); else output_warning("WARNING: not a number in --lfo-update-freq option. ignoring it..."); break; case 307: if (isfloat(optarg)) if (atoi(optarg)<=0) output_warning("WARNING: envelope-update-freq must be positive. ignoring it..."); else envelope_update_freq_hz=atof(optarg); else output_warning("WARNING: not a number in --envelope-update-freq option. ignoring it..."); break; default: cout << "ERROR: invalid command line options. try the --help switch" << endl; exit(1); } } }