When i use the MidiBuffer::Iterator can i clear messages in the iteration loop or will it break the iterator and i need to re-iterate the buffer. I want to clear some events based on the MidiThru option while processing in the processBlock() AudioProcessor call.
That’d definitely break, it’s a packed structure so the iterator would have to start again from the beginning.
Anyone has any suggestions on how to remove selected (based on the midi channel) MidiMessages from a MidiBuffer without re-iterating it and without additional memory allocations?
btw. gr8 avatar Jules, you look like a move star or someone of equal importance.
Depending on what you’re doing, the best approach is probably to have a second buffer, and copy any events into it that you DO want while iterating, and then swap them over afterwards (which is very quick to do).
Well, my next-door neighbour is one of the UK’s top portrait photographers, and she owed me a favour…
I thought about keeping a second MidiBuffer with some pre-allocated data and copy the wanted messages to it and then swap back as you say. I’ll try that.
Yeah, weird. I’m getting some cognitive dissonance between movie star and programming genius.