MIDI-Input-Fine-Grained
This is an example on how to attach your own callbacks for receiving MIDI input. This example has fine-grained callbacks, i.e. one for each message type (Note On, Note Off, Control Change, System Exclusive ...).
- 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.ino
-
MIDI-Input-Fine-Grained-All-Callbacks.ino for a list of all callbacks for all message types
Written by PieterP, 2021-06-26
https://github.com/tttapa/Control-Surface
Serial << "Note Off: " << channel << ", note " << note << ", velocity "
<< velocity << ", " << cable << endl;
}
Serial << "Note On: " << channel << ", note " << note << ", velocity "
<< velocity << ", " << cable << endl;
}
} callback;
void setup() {
Serial.begin(115200);
}
void loop() {
}
The main header file that includes all Control-Surface header files.
A type-safe class for MIDI USB Cable numbers.
A type-safe class for MIDI channels.
void onNoteOff(Channel channel, uint8_t note, uint8_t velocity, Cable cable)
void onNoteOn(Channel channel, uint8_t note, uint8_t velocity, Cable cable)
void update() override
Poll the backend (if necessary) and invoke the callbacks for any received MIDI messages,...
void begin() override
Initialize.
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.