I want to resume playback of my audio - rather than starting fresh playback
You would need to keep track of which notes have received a noteOn
message with no corresponding noteOff
. MidiKeyboardState
does this — just send it all the incoming MIDI data with processNextMidiBuffer
then call isNoteOn
to check if a note is already playing.
However this only works if playback was stopped and started in the same spot, without seeking. MIDI is inherently stateful, so there is no way to check if a note is on without keeping track of noteOn
and noteOff
events.
This won’t work in all DAWs, because some DAWs will send all note offs (or an all sound off events) when playback stops.
2 Likes