I have a control that allows the user to transpose the incoming Midi notes. My plugin also has an onscreen keyboard component that uses a MidiKeyboardState. The MidiKeyboardState merges the incoming Midi stream with the new notes generated by clicking the onscreen keyboard…but I need to transpose the incoming Midi and not the component generated notes.
I’m not sure what the most efficient way is to transpose MidiMessages in a MidiBuffer. It looks like MidiBuffer::Iterator just gives a copy of the MidiMessage and I don’t see a way to replace a single MidiMessage.
Given that, it seems I have to have another MidiBuffer, read noteOns from the original, transpose it and add it to the other MidiBuffer but I have to wonder about memory allocation. It would be great to just be able to transpose a Midi noteOn message in place but that doesn’t seem to be an option.
So…what’s the most efficient way to do this?