Exemple #1
0
void MidiTrack::readTrackData(istream & input)
{
	long totalTicks = 0;

	while (!input.eof()) {

		VariableLengthInt delta(input);
		totalTicks += delta.getValue();

		MidiEvent * E = MidiEvent::parseEvent(totalTicks, delta.getValue(), input);
		if (E == NULL) {
			cout << "Event skipped!";
			continue;
		}

		if (VERBOSE) {
			cout << E->toString().c_str();
		}

		// Not adding the EndOfTrack event here allows the track to be edited
		// after being read in from file.
		if (E->getType() == MetaEvent::END_OF_TRACK) {
			break;
		}
		mEvents.push_back(E);
	}
}