Let’s say, for example, I have a button that is to inject a chord of notes into the MIDI stream. I want to press the button, and add the notes into the MidiBuffer, so that when it arrives in processBlock(), it already contains them and the code there can handle it just like other incoming MIDI from a host.
EDIT: I guess I could put those events into a separate MidiBuffer, and then “merge” them at the head of processBlock, although that seems more work than just putting them in the incoming MidiBuffer - if that is possible…
it sounds like the work would be the same, just in a different place… and, as I said, I don’t think the other is possible. unless it were another plugin prior to yours which inserted the events (but, again, that is just moving the task). If you make a function (or lambda in processBlock) that takes a MidiBuffer, you could just call it twice, once with your buffer, and once with the incoming hosts buffer
I don’t think so, at least not without outputting MIDI (from the previous processBlock). That MIDI buffer is provided by the host just before calling our processBlock function (via the appropriate wrapper code), so there is no buffer for you to insert data into. Easier to just have your own buffer of MIDI data available to the Processor and process that in processBlock along with the given buffer. (Don’t see why you’d need to “merge” them, though. Why not just process one and then the other?)
Well, there’s already a bunch of code written that operates on the incoming MidiBuffer, so I don’t want to do that twice, or make a function out of it and operate it on two buffers; I just want the new events in the same buffer and do it once.