MidiBuffer::Iterator::getNextEvent sample position always 0


#1

Hello

I am using MidiBuffer iterator (with Juce 1.51):

MidiBuffer::Iterator it(buffer);
MidiMessage msg(0x80,0,0,0) ;
int pos;
while(it.getNextEvent(msg , pos)) {
	...
}

well, pos is always 0.

Is there any bug with getNextEvent ?

Thanks


#2

What makes you think that these events don’t really all have a timestamp of 0?


#3

I’m trying to get my head around that too;
the MidiMessageCollector::addMessageToQueue function is adding the event with a sampleNumber != 0,
but when I retrieve the event using the getNextEvent function, the sample position is 0 too. Where did the sample position get reset?


#4

The messages that get stored in a MidiBuffer don’t keep their timestamps, only their content is stored, along with a sample offset within that buffer.