Hi all,
Is it possible for a MIDI controller to have multiple USB and serial interfaces with some single and others with bidirectional communication? Here’s what I’m trying to set up:
- Controller keyboard midi out via 5 Pin DIN to Arduino in (RX)
- Arduino midi in & out via USB to stand alone PC with soft synth
- Arduino midi in & out via 5 Pin DIN to Emagic AMT8 hardware midi interface hooked up to my Mac Pro running Logic Audio.
I assume I need to define the proper RX & TX pins for the 5 pin DIN connectors?
Would this code work:
#include <Control_Surface.h>
// Instantiate a MIDI over USB interface
USBMIDI_Interface midi_usb;
// Instantiate 2 MIDI over Serial interface using `Serial1` & ‘Serial2’
HardwareSerialMIDI_Interface midi_ser1 = Serial1;
HardwareSerialMIDI_Interface midi_ser2 = Serial2;
// Instantiate the three pipes to connect the interfaces to Control_Surface
MIDI_Pipe pipe_tx_u, pipe_rx_u, pipe_tx_s1, pipe_rx_s1, pipe_rx_s2
// Instantiate a number of controls
// Buttons, Pots, LEDs, etc…
void setup() {
// Manually route MIDI output from Control_Surface to the USB MIDI interface
Control_Surface >> pipe_tx_u >> midi_usb1;
// Manually route MIDI output from the USB MIDI interface to Control_Surface
Control_Surface << pipe_rx_u << midi_usb1;
// Manually route MIDI output from Control_Surface to the Serial MIDI interface
Control_Surface >> pipe_tx_s >> midi_ser;
// Manually route MIDI output from the Serial MIDI interface to Control_Surface
Control_Surface << pipe_rx_s << midi_ser;
// Manually route MIDI output from the USB MIDI interface to Control_Surface
Control_Surface << pipe_rx_u << midi_usb2;
// Initialize everything
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
}
Any direction would be great.