//
// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
// Creation Date: Mon Feb 25 17:33:53 PST 2002
// Last Modified: Mon Feb 25 17:33:56 PST 2002
// Filename: ...sig/examples/all/mus2pmx2.cpp
// Web Address: http://sig.sapp.org/examples/museinfo/score/mus2pmx2.cpp
// Syntax: C++; museinfo
//
// Description: Convert SCORE binary files into ASCII using the
// ScorePage class.
//
#include "ScorePage.h"
#include "Options.h"
#include <stdlib.h>
#ifndef OLDCPP
#include <fstream>
#else
#include <fstream.h>
#endif
// interface variables:
Options options;
int verboseQ = 0; // used with the -v option
int sortQ = 0; // used with the -s option
int analysisQ = 0; // used with the -a option
int main(int argc, char** argv) {
options.define("v|verbose=b", "display debugging information in output");
options.define("s|sort=b", "sort data by staff in output");
options.define("a|analysis=b", "generate music analysis of data");
options.process(argc, argv);
verboseQ = options.getBoolean("verbose");
sortQ = options.getBoolean("sort");
analysisQ = options.getBoolean("analysis");
if (options.getArgCount() == 0) {
cout << "Usage: " << argv[0] << " input.mus " << endl;
exit(1);
}
ScorePage page;
for (int i=1; i<=options.getArgCount(); i++) {
if (options.getArgCount() > 1) {
cout << "; FILE = " << options.getArg(i) << "\n";
}
page.clear();
page.readBinary(options.getArg(i), verboseQ);
if (sortQ) {
page.sortByStaff();
}
if (analysisQ) {
page.analyzeSystems();
page.analyzePitch();
}
page.printAscii(cout, verboseQ);
}
return 0;
}
// md5sum: daeefb0b33e19f788bdab6fc423efdae mus2pmx2.cpp [20050403]