// // Programmer: Craig Stuart Sapp // Creation Date: Mon Oct 25 20:55:49 PDT 2004 // Last Modified: Mon Oct 25 20:55:53 PDT 2004 // Filename: ...sig/examples/all/ottava.cpp // Web Address: http://sig.sapp.org/examples/museinfo/humdrum/ottava.cpp // Syntax: C++; museinfo // // Description: Convert ottava sections between sounding and score forms. // // *8va = found in sounding score which indicates that the following // music is printed one octave lower than it sounds when printed. // *8va/V = found in visual score which indicates that the following // music is one octave lower than actual sounding pitch. // *8ba, *8ba/V = used for ottava basso indications. // *15ma, *15ma/V = used for quintessima (two octaves up) indications. // *15ba, *15ba/V = used for quintessima basso (two octaves down) indications. // // Signifiers cancelled by adding an "X" in front of the prevailing // ottava marker: *X8va, *X8va/V, *X8ba, *X8ba/V, *X15ma, *X15ma/V, // *X15ba, *X15ba/V. // #include "humdrum.h" #include #include using namespace std; /////////////////////////////////////////////////////////////////////////// #define TOSOUND 1 #define TOVISUAL -1 // function declarations void checkOptions (Options& opts, int argc, char* argv[]); void example (void); void usage (const string& command); void processFile (HumdrumFile& infile); void checkLineForOttavas(HumdrumFile& infile, int index, vector& states); void printDataLine (HumdrumFile& infile, int line, vector& octavestate, int direction); void printNoteData (HumdrumRecord& dataline, int index, int transpose); void printTandemInterpretation(HumdrumFile& infile, int line, int direction); // global variables Options options; // database for command-line arguments int direction = 0; // used with -v (+1) and -s (-1) arguments /////////////////////////////////////////////////////////////////////////// int main(int argc, char* argv[]) { HumdrumFile infile; // process the command-line options checkOptions(options, argc, argv); string filename; infile.clear(); // if no command-line arguments read data file from standard input int numinputs = options.getArgCount(); if (numinputs < 1) { infile.read(cin); } else { filename = options.getArg(1).data(); infile.read(filename); } processFile(infile); } /////////////////////////////////////////////////////////////////////////// ////////////////////////////// // // processFile -- // void processFile(HumdrumFile& infile) { int maxtracks = infile.getMaxTracks(); vector octavestate(maxtracks+1, 0); for (int i=0; i& octavestate, int direction) { int i; int ptrack = 0; int transpose = 0; for (i=0; i& states) { int j; for (j=0; j