src/Convert-pitch.cpp
int Convert::kernToOctaveNumber(const string& kerndata) {
	int uc = 0;
	int lc = 0;
	if (kerndata == ".") {
		return -1000;
	}
	for (int i=0; i<(int)kerndata.size(); i++) {
		if (kerndata[i] == ' ') {
			break;
		}
		if (kerndata[i] == 'r') {
			return -1000;
		}
		uc += ('A' <= kerndata[i]) && (kerndata[i] <= 'G') ? 1 : 0;
		lc += ('a' <= kerndata[i]) && (kerndata[i] <= 'g') ? 1 : 0;
	}
	if ((uc > 0) && (lc > 0)) {
		// invalid pitch description
		return -1000;
	}
	if (uc > 0) {
		return 4 - uc;
	} else if (lc > 0) {
		return 3 + lc;
	} else {
		return -1000;
	}
}
//////////////////////////////
//
// Convert::kernToOctaveNumber -- Convert a kern token into an octave number.
//    Middle C is the start of the 4th octave. -1000 is returned if there
//    is not pitch in the string.  Only the first subtoken in the string is
//    considered.
//
:kernToOctaveNumber -- Convert a kern token into an octave number.
Middle C is the start of the 4th octave. -1000 is returned if there
is not pitch in the string.  Only the first subtoken in the string is
considered.
: kernToOctaveNumber -- Convert a kern token into an octave number . Middle C is the start of the 4th octave . - 1000 is returned if there is not pitch in the string . Only the first subtoken in the string is considered .
int Convert::kernToOctaveNumber(const string& kerndata) {
	int uc = 0;
	int lc = 0;
	if (kerndata == ".") {
		return -1000;
	}
	for (int i=0; i<(int)kerndata.size(); i++) {
		if (kerndata[i] == ' ') {
			break;
		}
		if (kerndata[i] == 'r') {
			return -1000;
		}
		uc += ('A' <= kerndata[i]) && (kerndata[i] <= 'G') ? 1 : 0;
		lc += ('a' <= kerndata[i]) && (kerndata[i] <= 'g') ? 1 : 0;
	}
	if ((uc > 0) && (lc > 0)) {
		return -1000;
	}
	if (uc > 0) {
		return 4 - uc;
	} else if (lc > 0) {
		return 3 + lc;
	} else {
		return -1000;
	}
}
int Convert :: kernToOctaveNumber ( const string & kerndata ) { int uc = 0 ; int lc = 0 ; if ( kerndata == " " ) { return -1000 ; } for ( int i = 0 ; i < ( int ) kerndata . size ( ) ; i ++ ) { if ( kerndata [ i ] == ' ' ) { break ; } if ( kerndata [ i ] == ' ' ) { return -1000 ; } uc += ( ' ' <= kerndata [ i ] ) && ( kerndata [ i ] <= ' ' ) ? 1 : 0 ; lc += ( ' ' <= kerndata [ i ] ) && ( kerndata [ i ] <= ' ' ) ? 1 : 0 ; } if ( ( uc > 0 ) && ( lc > 0 ) ) { return -1000 ; } if ( uc > 0 ) { return 4 - uc ; } else if ( lc > 0 ) { return 3 + lc ; } else { return -1000 ; } }
Convert::kernToOctaveNumber -- Convert a kern token into an octave number.
Convert :: kernToOctaveNumber -- Convert a kern token into an octave number .
// invalid pitch description