Exemplo n.º 1
0
int FILE_IO::getNextMidiMsg(int channel, int tick)
{
    MidiEvent event;

    while((event = midiFile.getEvent(0, index)).tick == tick){

        //if() continue; //cases to ignore
        printf("0\n");
        MidiMessage msg;
        msg.setSize(event.getSize());

        for(int i=0; i < event.getSize(); i++){
            msg[i] = event[i];
        }

        writeInMidiMsg(channel, msg);
        index++;

        if (index == midiFile.getNumEvents(0)){
            resetIndex();
            return 0;
        }

    }

    return 1;
}
Exemplo n.º 2
0
void MidiTrack::recalculateSize() {

	mSize = 0;

	MidiEvent * last = NULL;
	std::vector<MidiEvent*>::iterator it;
	for (it = mEvents.begin();
		it != mEvents.end();
		it++) {
		MidiEvent * E = *it;
		mSize += E->getSize();

		// If an event is of the same type as the previous event,
		// no status char is written.
		if (last != NULL && !E->requiresStatusByte(last)) {
			mSize--;
		}
		last = E;
	}

	mSizeNeedsRecalculating = false;
}