MidiBuffer::Iterator::getNextEvent sample position always 0



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 ?



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


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?


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.