MidiKeyboardComponent doesn't draw note on/note off in same MIDIBuffer seperated by time interval

Hi all,

I am working on an application where i generate note on/note off and put those events in a MIDI Buffer seperated by a time interval (250ms for example). 

I then want to feed the buffer to a MidiKeyboardState which is hooked up to a MidiKeyboardComponent. The MidiKeyboardComponent is a listener of the MidiKeyboardState. 

I am calling MidiKeyboardState::processNextMidiBuffer with my buffer in the audio callback. This calls processNextMidiEvent for the note on and note off which calls noteOnInternal/noteOffInternal. This in turn updates noteStates twice, once when processing the note on and once for the note off. The result is that in the MidiKeyboardComponent nothing gets drawn. 

This is because MidiKeyboardState/MidiKeyboardComponent don't seem to care about the timing of these events. Am I correct or am I missing something? 

What's the proper way to visualize this and to make sure MidiKeyboardComponent displays the key going down briefly? 

I could of course put the note on/off in 2 seperate buffers and then somehow pass these at the right time to processNextMidiBuffer (??????) but this seems like a hack and I can't believe there isn't a better way in JUCE. 

Thanks for helping!

Bert 

 

The way it works seems pretty sensible to me.. Normally these buffers will be so short that a note on/off pair within one buffer would be shorter than a video frame, so drawing it wouldn't really make much sense. The only "correct" way to implement this would be for the keyboard component to have a minimum time setting and to never clear a pressed note until it has been visible for at least that length of time, and that seems like overkill to me.