Custom-USB-MIDI-Backend
This is an example that demonstrates how to extend the library using your own MIDI USB backend. It defines a class for sending and receiving raw MIDI USB packets that can be plugged into Control Surface's USBMIDI_Interface class.
- See also
- src/MIDI_Interfaces/USBMIDI/USBMIDI_Teensy3.hpp
-
src/MIDI_Interfaces/USBMIDI/USBMIDI_MIDIUSB.hpp
-
src/MIDI_Interfaces/USBMIDI/USBMIDI_Adafruit_TinyUSB.hpp
-
src/MIDI_Interfaces/USBHostMIDI_Interface.hpp
- Boards: 🛈
- AVR, AVR USB, Nano Every, Due, Nano 33 IoT, Nano 33 BLE, UNO R4, Pi Pico, Teensy 3.x, ESP32
Connections
None.
Behavior
- Prints the raw MIDI USB packets to the Serial Monitor.
- Receives no MIDI input.
Mapping
None.
Written by PieterP, 2022-05-28
https://github.com/tttapa/Control-Surface
struct MyUSBMIDIBackend {
void begin() { Serial.
begin(115200); }
MIDIUSBPacket_t read() { return MIDIUSBPacket_t {}; }
void write(MIDIUSBPacket_t p) { Serial <<
AH::HexDump(p.data) << endl; }
void sendNow() { Serial.flush(); }
bool preferImmediateSend() { return false; }
};
MyUSBMIDI_Interface() = default;
using MIDIUSBPacket_t = MyUSBMIDIBackend::MIDIUSBPacket_t;
};
MyUSBMIDI_Interface midi;
void setup() {
}
void loop() {
static Timer<millis> timer {1000};
if (timer)
}
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.
@ TimingClock
Timing Clock System Real-Time message.
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
void begin() override
Initialize the shift register.
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 MIDI messages over a USB MIDI connection.
void sendRealTime(MIDIMessageType rt, Cable cable=Cable_1)
Send a MIDI Real-Time message.