// // Programmer: Craig Stuart Sapp // Creation Date: Thu Nov 16 15:58:02 PST 2000 // Last Modified: Thu Nov 16 15:58:08 PST 2000 // Filename: ...sig/examples/all/midimel.cpp // Web Address: http://sig.sapp.org/examples/museinfo/midi/midimel.cpp // Syntax: C++; museinfo // // Description: generate MIDI note numbers for short melodic sequences // stored in the first spine of a Humdrum file in **kern format. // // #include "humdrum.h" #include // function declarations void checkOptions (Options& opts, int argc, char* argv[]); void example (void); void processRecords (HumdrumFile& infile); void usage (const char* command); // global variables Options options; // database for command-line arguments /////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { HumdrumFile infile; // process the command-line options checkOptions(options, argc, argv); // figure out the number of input files to process int numinputs = options.getArgCount(); for (int i=0; i 0) { cout << options.getArg(i+1)<< ": "; } processRecords(infile); cout << "\n"; } return 0; } /////////////////////////////////////////////////////////////////////////// ////////////////////////////// // // checkOptions -- validate and process command-line options. // void checkOptions(Options& opts, int argc, char* argv[]) { opts.define("author=b"); // author of program opts.define("version=b"); // compilation info opts.define("example=b"); // example usages opts.define("h|help=b"); // short description opts.process(argc, argv); // handle basic options: if (opts.getBoolean("author")) { cout << "Written by Craig Stuart Sapp, " << "craig@ccrma.stanford.edu, Nov 2000" << endl; exit(0); } else if (opts.getBoolean("version")) { cout << argv[0] << ", version: 17 April 2000" << endl; cout << "compiled: " << __DATE__ << endl; cout << MUSEINFO_VERSION << endl; exit(0); } else if (opts.getBoolean("help")) { usage(opts.getCommand().c_str()); exit(0); } else if (opts.getBoolean("example")) { example(); exit(0); } } ////////////////////////////// // // example -- example usage of the quality program // void example(void) { cout << " \n" << endl; } ////////////////////////////// // // processRecords -- // void processRecords(HumdrumFile& infile) { int i; int midinum; for (i=0; i