Beispiel #1
0
int main(int argc, char** argv) {
   if (argc > 2) {
      cout << "Usage: " << argv[0] << " input-file" << endl;
      exit(1);
   }

   HumdrumFile hfile;
   if (argc == 2) {
      hfile.read(argv[1]);
   } else if (argc == 1) {
      hfile.read(cin);
   }
   
   hfile.analyzeRhythm("4", DEBUG);

   int measure = 0;

   cout << "absbeat\tdur\tbeat\tmeasure\t::\tdata\n";
   cout << ":::::::::::::::::::::::::::::::::::::::::::::::::::::\n";
   for (int i=0; i<hfile.getNumLines(); i++) {
      if (hfile[i].isMeasure()) {
         sscanf(hfile[i][0], "=%d", &measure);
      }
      cout << hfile.getAbsBeat(i) << '\t'
           << hfile.getDuration(i) << '\t'
           << measure << '\t'
           << hfile.getBeat(i) << "\t::\t"
           << hfile.getLine(i) << endl;
   }

   return 0;
}
Beispiel #2
0
void displayResults(HumdrumFile& hfile, int count, const char* filename) {
   for (int i=0; i<hfile.getNumLines(); i++) {
      if ((hfile[i].getType() == E_humrec_interpretation) &&
          (strcmp(hfile[i][0], "*-") == 0)) {
         if (count > 1) {
            cout << filename << ":\t";
         }
         cout << hfile.getAbsBeat(i) << "\n";
      }
   }
}
Beispiel #3
0
void printMarkerInfo(ostream& out, int mindex, int line, HumdrumFile& infile,
		int style) {
	double absbeat = infile.getAbsBeat(line);
	double measure = -10;
	double beat = infile[line].getBeat();

	int i;
	int counter = 0;
	for (i=line; i>=0; i--) {
		if (data[i].isMeasure()) {
			counter++;
			if (sscanf(data[i][0], "=%lf", &measure)) {
				break;
			}
			if (counter >= 2) {
				// don't search more than two measures backwards
				break;
			}
		}
	}

	if (style == 0) {
		out << mindex << "\t" << line+1 << "\t" << absbeat;
		out << "\t" << measure << "\t" << beat;
	} else {
		out << "Mark:"         << mindex
			  << "\tLine:"       << line+1
			  << "\tAbsbeat:"    << absbeat;
		if (measure > -10) {
			out << "\tMeasure:" << measure;
		}
		if (beat >= 0) {
			out << "\tBeat:"    << beat;
		}
	}

}