Beispiel #1
0
void printKernOutput(HumdrumFile& infile) {
	int i, j;
	infile.analyzeRhythm("4");
	infile.printNonemptySegmentLabel(cout);
	for (i=0; i<infile.getNumLines(); i++) {
		if (!infile[i].isData()) {
			cout << infile[i].getLine() << "\n";
			continue;
		}
		for (j=0; j<infile[i].getFieldCount(); j++) {
			if (!infile[i].isExInterp(j, "**kern")) {
				if (strcmp(infile[i][j], ".") == 0) {
					if (parensQ) {
						cout << "(";
					}
					cout << infile.getDotValue(i, j);
					if (parensQ) {
						cout << ")";
					}
				} else {
					cout << infile[i][j];
				}
			} else {
				// this is **kern data, so create tied notes if note duration
				// is longer than the current line's duration
				printKernTokenLineDuration(infile, i, j);
			}
			if (j < infile[i].getFieldCount() - 1) {
				cout << "\t";
			}
		}
		cout << "\n";
	}
}
Beispiel #2
0
void printOutput(HumdrumFile& infile) {
	int i, j;
	string data;
	PerlRegularExpression pre;
	infile.printNonemptySegmentLabel(cout);
	for (i=0; i<infile.getNumLines(); i++) {
		if (infile[i].getType() && (E_humrec_data == 0)) {
			cout << infile[i].getLine() << "\n";
		} else {
			for (j=0; j<infile[i].getFieldCount(); j++) {
				if (strcmp(infile[i][j], ".") == 0) {
					if (parensQ) {
						cout << "(";
					}
					data = infile.getDotValue(i, j);

					if (charQ) {
						pre.sar(data, charString, "", "g");
					}

					if (xcharQ) {
						pre.sar(data, xcharString, "", "g");
					}

					if (data == "") {
						data = ".";
					}
					cout << data;
					if (parensQ) {
						cout << ")";
					}
				} else {
					cout << infile[i][j];
				}
				if (j < infile[i].getFieldCount() - 1) {
					cout << "\t";
				}
			}
			cout << "\n";
		}
	}
}
Beispiel #3
0
void processFile(HumdrumFile& infile, int setcount) {
   int i;
   PerlRegularExpression pre;

   int revQ = option_V;

   // if bibliographic/reference records are not suppressed
   // print the !!!!SEGMENT: marker if present.
   if ((setcount > 1) && (!option_G)) {
      infile.printNonemptySegmentLabel(cout);
   }

   for (i=0; i<infile.getNumLines(); i++) {

      if (option_D && (infile[i].isMeasure() || infile[i].isData())) {
         // remove data lines if -D is specified
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_d) {
         // remove null data lines if -d is specified
         if (option_k && infile[i].isData() && 
               infile[i].equalFieldsQ("**kern", ".")) {
            // remove if only all **kern spines are null.
            if (revQ) {
               cout << infile[i] << "\n";
            }
            continue;
         } else if (!option_k && infile[i].isData() && 
               infile[i].equalDataQ(".")) {
            // remove null data lines if all spines are null.
            if (revQ) {
               cout << infile[i] << "\n";
            }
            continue;
         }
      }
      if (option_G && (infile[i].isGlobalComment() || 
            infile[i].isBibliographic())) {
         // remove global comments if -G is specified
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_g && pre.search(infile[i][0], "^!!+\\s*$", "")) {
         // remove empty global comments if -g is specified
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_I && infile[i].isInterpretation()) {
         // remove all interpretation records
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_i && infile[i].isInterpretation() && 
            infile[i].equalDataQ("*")) {
         // remove null interpretation records
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_L && infile[i].isLocalComment()) {
         // remove all local comments
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_l && infile[i].isLocalComment() && 
            infile[i].equalDataQ("!")) {
         // remove null local comments
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_T && infile[i].isTandem()) {
         // remove tandem (non-manipulator) interpretations
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_U) {
         // remove unnecessary (duplicate exclusive) interpretations
         // HumdrumFile class does not allow duplicate ex. interps.
         // continue;
      }

      // non-classical options:

      if (option_M && infile[i].isMeasure()) {
         // remove all measure lines
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_C && infile[i].isComment()) {
         // remove all comments (local & global)
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }
      if (option_c && (infile[i].isLocalComment() || 
            infile[i].isGlobalComment())) {
         // remove all comments (local & global)
         if (revQ) {
            cout << infile[i] << "\n";
         }
         continue;
      }

      // got past all test, so print the current line:
      if (!revQ) {
         cout << infile[i] << "\n";
      }
   }

}