Control Surface  1.2.0
MIDI Control Surface library for Arduino
Dual-MIDI-Interface.ino

Dual-MIDI-Interface

This example demonstrates how to group together two or more MIDI interfaces, so you can send the MIDI output over both MIDI USB and 5-pin DIN MIDI, for example. MIDI input is received from all interfaces as well.

Also have a look at the MIDI_Pipes-Routing.ino example, the MIDI Routing module and the MIDI_Pipe documentation for more information about MIDI routing.
Control Surface can be used as both a MIDI sink and a MIDI source.

When you call Control_Surface.begin(), it automatically connects itself to the default MIDI interface (MIDI_Interface::getDefault()).
If you want to route everything manually, you have to connect it before calling Control_Surface.begin(), or you have to disconnect the default pipes before connecting your own, using Control_Surface_::disconnectMIDI_Interfaces().

Boards:
AVR USB, Nano Every, Due, Teensy 3.x

Connections

Connect the left terminal of the potentiometer to ground, and the right one to VCC.

Behavior

Mapping

Written by PieterP, 2019-08-22
https://github.com/tttapa/Control-Surface

// Create two MIDI interfaces
HardwareSerialMIDI_Interface serialmidi = {Serial1, MIDI_BAUD};
// Create a MIDI pipe factory to connect the MIDI interfaces to Control Surface
// Add some MIDI elements to show that the MIDI interfaces actually work
NoteValueLED led = {LED_BUILTIN, 0x3C};
void setup() {
// Manually connect the MIDI interfaces to Control Surface
Control_Surface | pipes | usbmidi;
Control_Surface | pipes | serialmidi;
// Initialize Control Surface _after_ connecting the interfaces
}
void loop() {
}
/*
* The vertical pipe operator (|) is used to make a bidirectional connection
* between a MIDI sink or source and a MIDI pipe.
* You can also use unidirectional pipes. These can be connected using the
* stream operators (<< and >>).
*
* For example:
*
* MIDI_PipeFactory<2> pipes;
* ...
* Control_Surface >> pipes >> usbmidi; // Output to usbmidi
* Control_Surface << pipes << serialmidi; // Input from serialmidi
*/
USBMIDI_Interface
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
Definition: USBMIDI_Interface.hpp:41
MIDI_BAUD
constexpr auto MIDI_BAUD
Definition: MIDI_Interface.hpp:11
MIDI_PipeFactory
Class that produces multiple MIDI_Pipes.
Definition: MIDI_Pipes.hpp:557
Control_Surface.h
The main header file that includes all Control-Surface header files.
Control_Surface_::loop
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
Definition: Control_Surface_Class.cpp:68
Control_Surface
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
Definition: Control_Surface_Class.cpp:203
HardwareSerialMIDI_Interface
A class for MIDI interfaces sending and receiving MIDI messages over a Hardware Serial port.
Definition: SerialMIDI_Interface.hpp:138
MIDI_CC::General_Purpose_Controller_1
constexpr uint8_t General_Purpose_Controller_1
Definition: Control_Change.hpp:32
NoteValueLED
MIDI Input Element that listens for MIDI Note messages for the given note, and displays its value by ...
Definition: NoteCCRangeLEDs.hpp:114
CCPotentiometer
A class of MIDIOutputElements that read the analog input from a potentiometer or fader,...
Definition: CCPotentiometer.hpp:20
Control_Surface_::begin
void begin()
Initialize the Control_Surface.
Definition: Control_Surface_Class.cpp:25