Closed Kirtai closed 1 year ago
Oh ffs, now I feel really dumb. That one doesn't do the virtual cable stuff.
Good idea! There is an updated version of the midi_adapter_flex on the branch virtual-midi-cable of this repo. If you manually replace the function midi_task()
in main.cpp with this one, you should get a version, which connects UART0 to virtual MIDI cable 0 on USB and UART1 to virtual cable 1 respectively:
void midi_task(void)
{
USB.Update ();
UART0.Update ();
UART1.Update ();
CMIDIMessage Msg;
if (USB.Read (&Msg))
{
if (Msg.Cable () == 0)
{
UART0.Write (Msg);
}
else if (Msg.Cable () == 1)
{
UART1.Write (Msg);
}
}
if (UART0.Read (&Msg))
{
Msg.Cable (0);
USB.Write (Msg);
}
if (UART1.Read (&Msg))
{
Msg.Cable (1);
USB.Write (Msg);
}
}
There is also an .uf2 file in the attached archive for easy install. Please note, that the updated code has not been tested. Let me know, if you got problems.
@Kirtai Did this work for you?
The access methods for the virtual MIDI cable in midi_adapter_flex have been tested as far as possible and merged to the main branch. The branch virtual-midi-cable has been removed.
Oof, sorry for not getting back to you sooner but I'm waiting for components to arrive. Thanks for this :)
Hi, Since the Pico has two hardware serial ports would it be possible to support multiple serial ports? (or more with PIO?)
I expect that a merger/splitter would be too complex but maybe each port could be connected to a separate virtual USB cable? That would make it a multi-port MIDI interface which is something more unusual, especially with each port's channels being separate.