Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
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.

The MIDI Tutorial has an entire section dedicated to MIDI routing: Routing MIDI messages. 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
// 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
NoteLED 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
*/
The main header file that includes all Control-Surface header files.
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
constexpr auto MIDI_BAUD
A class of MIDIOutputElements that read the analog input from a potentiometer or fader,...
void begin()
Initialize the Control_Surface.
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
A class for MIDI interfaces sending and receiving MIDI messages over a Hardware Serial port.
Generic base class for classes that listen for MIDI Note, Control Change and Key Pressure events on a...
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
constexpr uint8_t General_Purpose_Controller_1
Class that produces multiple MIDI_Pipes.