// // Programmer: Craig Stuart Sapp // Creation Date: Wed Mar 13 18:43:11 PST 2002 // Last Modified: Wed Mar 13 19:22:31 PST 2002 // Filename: ...sig/examples/all/esac2hum.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/esac2hum.cpp // Syntax: C++; museinfo // // Description: Converts an EsAC file into Humdrum. // #include "humdrum.h" #include #include #ifndef OLDCPP #include #include #else #include #include #endif // function declarations: void checkOptions (Options& opts, int argc, char** argv); void example (void); void usage (const char* command); void makeIndex (const char* name, HumdrumFile& infile, ostream& out); // User interface variables: Options options; int debugQ = 0; // used with the --debug option int verboseQ = 0; // used with the -v option ////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { // process the command-line options checkOptions(options, argc, argv); HumdrumFile infile; int i; for (i=1; i<=options.getArgCount(); i++) { infile.clear(); infile.read(options.getArg(i)); makeIndex(options.getArg(i).c_str(), infile, cout); } return 0; } ////////////////////////////////////////////////////////////////////////// ////////////////////////////// // // makeIndex -- // void makeIndex(const char* name, HumdrumFile& infile, ostream& out) { int i; int found = 0; static char nametag[1024] = {0}; for (i=0; i 0) { oldnote = note; note = pitch; cout << (note - oldnote) << ' '; } } } } cout << endl; } ////////////////////////////// // // checkOptions -- // void checkOptions(Options& opts, int argc, char* argv[]) { opts.define("debug=b", "print debug information"); opts.define("v|verbose=b", "verbose output"); opts.define("h|header=s:", "Header filename for placement in output"); opts.define("t|trailer=s:", "Trailer filename for placement in output"); opts.define("s|split=s:file", "Split song info into separate files"); opts.define("x|extension=s:.krn", "Split filename extension"); opts.define("f|first=i:1", "Number of first split filename"); opts.define("author=b", "author of program"); opts.define("version=b", "compilation info"); opts.define("example=b", "example usages"); opts.define("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, March 2002" << endl; exit(0); } else if (opts.getBoolean("version")) { cout << argv[0] << ", version: 13 March 2002" << 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); } debugQ = opts.getBoolean("debug"); verboseQ = opts.getBoolean("verbose"); } ////////////////////////////// // // example -- // void example(void) { } ////////////////////////////// // // usage -- // void usage(const char* command) { } // md5sum: e61ec4d52c00e7ccd2d015da8a6bf92b plindex.cpp [20160320]