16template <
class Backend>
22 template <
class... Args>
24 :
backend {std::forward<Args>(args)...},
45 const char *
getName()
const override {
return "usb"; }
94 uint8_t d1, uint8_t d2) {
95 uint8_t cn_cin = (cn.
getRaw() << 4) | uint8_t(cin);
134#include "USBMIDI_Interface.ipp"
136#if defined(TEENSYDUINO) && !defined(TEENSY_MIDIUSB_ENABLED)
138 "Teensy: USB MIDI not enabled. Enable it from the Tools > USB Type menu.")
139#define CS_USB_MIDI_DISABLED
143#if (!defined(CS_USB_MIDI_NOT_SUPPORTED) && !defined(CS_USB_MIDI_DISABLED)) || \
177#elif !defined(CS_USB_MIDI_DISABLED)
MIDIReadEvent
Values returned by the MIDI reading functions.
MIDICodeIndexNumber
MIDI USB Code Index Numbers.
#define BEGIN_CS_NAMESPACE
MIDIUSB_USBDeviceMIDIBackend USBDeviceMIDIBackend
A type-safe class for MIDI USB Cable numbers.
constexpr uint8_t getRaw() const
Get the cable as an integer.
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
ChannelMessage getChannelMessage() const
Return the received channel voice message.
RealTimeMessage getRealTimeMessage() const
Return the received real-time message.
GenericUSBMIDI_Interface(const GenericUSBMIDI_Interface &)=delete
void sendChannelMessageImpl(ChannelMessage) override
Low-level function for sending a MIDI channel voice message.
void alwaysSendImmediately()
Send the USB packets immediately after sending a MIDI message.
void handleStall() override
Call back that should finish any MIDI messages that are in progress, and un-stall the pipe or MIDI so...
void update() override
Poll the backend (if necessary) and invoke the callbacks for any received MIDI messages,...
void neverSendImmediately()
Don't send the USB packets immediately after sending a MIDI message.
GenericUSBMIDI_Interface & operator=(GenericUSBMIDI_Interface &&)=delete
USBMIDI_Sender sender
Sends USB MIDI messages.
void sendNowImpl() override
Low-level function for sending any buffered outgoing MIDI messages.
SysCommonMessage getSysCommonMessage() const
Return the received system common message.
void sendRealTimeImpl(RealTimeMessage) override
Low-level function for sending a MIDI real-time message.
GenericUSBMIDI_Interface(GenericUSBMIDI_Interface &&)=delete
USBMIDI_Parser parser
Parses USB packets into MIDI messages.
const char * getName() const override
Get the staller's name for debugging purposes.
Backend backend
The (platform-specific) backend used for MIDI over USB communication.
void begin() override
Initialize.
GenericUSBMIDI_Interface & operator=(const GenericUSBMIDI_Interface &)=delete
void sendSysExImpl(SysExMessage) override
Low-level function for sending a system exclusive MIDI message.
bool alwaysSendImmediately_
void sendSysCommonImpl(SysCommonMessage) override
Low-level function for sending a MIDI system common message.
bool alwaysSendsImmediately() const
Check if this USB interface always sends its USB packets immediately after sending a MIDI message.
GenericUSBMIDI_Interface(Args &&...args)
Construct a new GenericUSBMIDI_Interface.
MIDIReadEvent read()
Try reading and parsing a single incoming MIDI message.
SysExMessage getSysExMessage() const
Return the received system exclusive message.
An abstract class for MIDI interfaces.
virtual void handleStall()=0
Call back that should finish any MIDI messages that are in progress, and un-stall the pipe or MIDI so...
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
Parser for MIDI over USB packets.
A class for sending MIDI USB messages.
A class for MIDI interfaces sending and receiving MIDI messages over the Serial port of the USB conne...
Functor to send USB MIDI packets.
void operator()(Cable cn, MIDICodeIndexNumber cin, uint8_t d0, uint8_t d1, uint8_t d2)
GenericUSBMIDI_Interface * iface
AH::Array< uint8_t, 4 > MIDIUSBPacket_t