Hi All,
I am creating a plugin that sends MIDI messages over USB to a hardware device. The plugin is written using JUCE/C++ and the firmware on the device is written in C. I can program the firmware on the device using a JTAG connection, and debug the firmware in Atmel studio.
I discovered that when trying to send a particular MIDI SysEx message, the message sent from my JUCE code is not the same as what is received when it reaches the firmware on the device. Importantly, this is AFTER accounting for the difference in formatting between standard MIDI and USB-MIDI formatting
The message sent from juce::MidiOutput::sendMessageNow is a 12-byte SysEx Message like this:
f0 00 02 04 26 00 02 06 01 00 09 91 00 16 04 01 f7
However when it reaches the designated midi buffer in the firmware, it shows up as as USB MIDI message as:
04 f0 00 02 04 26 00 02 06 01 f7 00 09 91 00 15 06 00 f7
if we convert that back into standard midi (there is a parser in the firmware which does this) that message would be:
f0 00 02 26 00 02 01 f7
at which point the f7 byte ends the sysex message, and then my other data shows up on the other side of that ended message (the 09, 91, 00 and 15 bytes that you can see above)
As you can see, the first 7 bytes are totally correct, and then there is an errant 01 followed by f7, which terminates the sysex message. The parser in the firmware is correctly ending the message when it encounters this f7 byte, but this ends the message prematurely, and I don’t know where in the system this erroneous byte is being added.
As far as I can tell, my JUCE code is sending the correct message, but I can’t tell where in the process the MIDI message is converted to USB-MIDI packets. I’m wondering if anyone with experience in USB-MIDI has any idea where in the process this message is getting corrupted, or where a smart place to look might be. My current guess here is maybe there’s something in the system which wrongly assumes that I’m sending a 7-byte message, and therefore truncating it, but again I’m not sure what piece of code is responsible for doing the “translation” from standard MIDI to USB-MIDI
Thanks!!
—Marc
