Midi noteOff question


I’m trying to figure out the best way to send midi note off message for each note that are generated by a plugin.

The noteOn are sent to the processBlock MidiBuffer and are time samped. But then, considering each note has a lengh (always the same), how to deal with the note off that would go out of the boundaries of the midi buffer ?
Should I write their time stamps, channel & note info into an array that would queue them, and calculate wrap around if needed ?
MidiCollector looks like a potential response, but I can’t get working fixed lengh for each note.

I guess someone must has been dealing with this situation before, so I wanted to ask before re-inventing the wheel or go the wrong way… Maybe there’s a simpler solution I overlooked ?
If anyone has a working example, it would be welcome.

BTW : a automatic lengh parameter to MidiMessage::noteOn would be handy :slight_smile:


Yeah, I think you’d just need to keep a list of the pending note-offs, and how many samples away each one is, and count it down until they get triggered.