MIDI-Input
This is an example on how to attach your own callbacks for receiving MIDI input.
- Boards: 🛈
- AVR, AVR USB, Nano Every, Due, Nano 33 IoT, Nano 33 BLE, UNO R4, Pi Pico, Teensy 3.x, ESP32, ESP8266
Connections
None.
Behavior
- When MIDI messages are sent to the USB interface, they are printed to the Serial port.
Mapping
None.
- See also
- MIDI-Input-Fine-Grained.ino
-
MIDI-Input-Fine-Grained-All-Callbacks.ino
Written by PieterP, 2020-06-11
https://github.com/tttapa/Control-Surface
Serial << F(
"Channel message: ")
<< hex <<
cm.header <<
' ' <<
cm.data1 <<
' ' <<
cm.data2 << dec
<< F(
" on cable ") <<
cm.cable.getOneBased() <<
endl;
}
Serial << F(
"System Exclusive message: [") <<
se.length <<
"] "
<< F(
" on cable ") <<
se.cable.getOneBased() <<
endl;
}
Serial << F(
"Real-time message: ")
<< hex <<
rt.message << dec
<< F(
" on cable ") <<
rt.cable.getOneBased() <<
endl;
}
} callback;
}
void loop() {
}
The main header file that includes all Control-Surface header files.
void update() override
Poll the backend (if necessary) and invoke the callbacks for any received MIDI messages,...
void begin() override
Initialize.
A class for callbacks from MIDI input.
virtual void onChannelMessage(MIDI_Interface &, ChannelMessage)
Callback for incoming MIDI Channel Messages (notes, control change, pitch bend, etc....
virtual void onSysExMessage(MIDI_Interface &, SysExMessage)
Callback for incoming MIDI System Exclusive Messages.
virtual void onRealTimeMessage(MIDI_Interface &, RealTimeMessage)
Callback for incoming MIDI Real-Time Messages.
An abstract class for MIDI interfaces.
void setCallbacks(MIDI_Callbacks *cb)
Set the callbacks that will be called when a MIDI message is received.
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
Array< T, N > copyAs(const Array< U, N > &src)
Copy an Array to an Array of a different type.
Print & endl(Print &printer)