I want to change the position of a midi message in a MidiBuffer in a Iterator like this:
MidiBuffer::Iterator iterator(b); MidiMessage m(0xf4, 0.0); while(iterator.getNextEvent(m, samplePos)) { m.setTimeStamp(newTimeStamp) }
But if I iterate the Buffer again, samplePos does not contain the previously set timestamp:
MidiBuffer::Iterator iterator2(b); MidiMessage m(0xf4, 0.0); while(iterator2.getNextEvent(m, samplePos)) { // samplePos != newTimeStamp }
In the API of Iterator::getNextEvent you can read:
this will be the message (the MidiMessage's timestamp is not set)
So how can I restore the previously set timestamp?
I tried to lurk in the source files of Iterator, but that's a bit too scary for me...