Write MIDI byte stream to USBMIDI

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I have a device with the following MIDI ports:

   

1. USBMIDI in/out
2. MIDI uart in/out (as a part of the USBMIDI device)
3. MIDI over SPI in/out

   

I want to be able to route messages from all the inputs to all the outputs. By "output" in this context I mean an output from my device.

   

Now, routing between USB and UART is simple, since it happens automatically.
Reading messages from these inputs and writing them onto SPI out is also simple.
Reading from SPI into a character buffer is up and running.

   

But what is the best way to write the messages from SPI to USB/UART outputs? The problem is that these messages are just received as a stream of bytes, i.e. they are not parsed into MIDI messages that fit as input to

   

USB_PutUsbMidiIn(USB_3BYTE_COMMON, midiMsg, USB_MIDI_CABLE_00);

   

Since the UART also gets its MIDI input as a byte stream, I assume it has a parser for it, but this doesn't seem to be covered in the API documentation. I'd rather not reinvent the wheel by writing another one, so is there any "correct" way to write data into this parser from code?

0 Likes
3 Replies