usbMidi Realtime messages without a callback function

trash80

Member
Currently usbMidi Realtime messages (sync, sequencer start/stop, etc) can only be parsed by the usbMidi class by utilizing a callback function.
For those of us who do not want or cannot use callbacks, there is no way around it.

I made a small modification to the usbMidi class that pushes the realtime message to data1 to expose the value, so that user code has access via usbMIDI.getData1()
IE:
Code:
if(usbMIDI.read() && usbMIDI.getType() == 8) {
    // realtime message received
    uint8_t realtimeMessage = usbMIDI.getData1();

    // realtimeMessage is 0xF8 if it was a clock tick message, sweeeeet.
}

Here is my PR -
https://github.com/PaulStoffregen/cores/pull/168

Thoughts?
 
Back
Top