An abstract class for MIDI interfaces. More...
#include <MIDI_Interfaces/MIDI_Interface.hpp>
Public Member Functions | |
virtual | ~MIDI_Interface () |
Destructor. More... | |
virtual void | begin () |
Initialize the MIDI Interface. More... | |
void | send (uint8_t m, uint8_t c, uint8_t d1, uint8_t d2) |
Send a 3-byte MIDI packet. More... | |
void | send (uint8_t m, uint8_t c, uint8_t d1) |
Send a 2-byte MIDI packet. More... | |
void | sendOnCable (uint8_t m, uint8_t c, uint8_t d1, uint8_t d2, uint8_t cn) |
Send a 3-byte MIDI packet with cable number. More... | |
void | sendOnCable (uint8_t m, uint8_t c, uint8_t d1, uint8_t cn) |
Send a 2-byte MIDI packet with cable number. More... | |
void | sendOnCable (uint8_t r, uint8_t cn) |
Send a single-byte MIDI packet with cable number. More... | |
void | sendNoteOn (MIDICNChannelAddress address, uint8_t velocity) |
Send a MIDI Note On event. More... | |
void | sendNoteOff (MIDICNChannelAddress address, uint8_t velocity) |
Send a MIDI Note Off event. More... | |
void | sendKP (MIDICNChannelAddress address, uint8_t pressure) |
Send a MIDI Key Pressure event. More... | |
void | sendCC (MIDICNChannelAddress address, uint8_t value) |
Send a MIDI Control Change event. More... | |
void | sendPC (MIDICNChannelAddress address) |
Send a MIDI Program Change event. More... | |
void | sendPC (MIDICNChannel address, uint8_t value) |
Send a MIDI Program Change event. More... | |
void | sendCP (MIDICNChannel address, uint8_t pressure) |
Send a MIDI Channel Pressure event. More... | |
void | sendPB (MIDICNChannel address, uint16_t value) |
Send a MIDI Pitch Bend event. More... | |
void | send (SysExMessage message) |
Send a MIDI System Exclusive message. More... | |
template<size_t N> | |
void | send (const uint8_t(&sysexdata)[N], uint8_t cn=0) |
Send a MIDI System Exclusive message. More... | |
void | send (uint8_t rt, uint8_t cn=0) |
Send a single-byte MIDI message. More... | |
virtual void | update ()=0 |
Read the MIDI interface and call the callback if a message is received. More... | |
void | setAsDefault () |
Set this MIDI interface as the default interface. More... | |
virtual void | setCallbacks (MIDI_Callbacks *cb)=0 |
Set the callbacks that will be called when a MIDI message is received. More... | |
void | setCallbacks (MIDI_Callbacks &cb) |
Set the callbacks that will be called when a MIDI message is received. More... | |
virtual void | sendImpl (uint8_t m, uint8_t c, uint8_t d1, uint8_t d2, uint8_t cn)=0 |
Low-level function for sending a 3-byte MIDI message. More... | |
virtual void | sendImpl (uint8_t m, uint8_t c, uint8_t d1, uint8_t cn)=0 |
Low-level function for sending a 2-byte MIDI message. More... | |
virtual void | sendImpl (const uint8_t *data, size_t length, uint8_t cn)=0 |
Low-level function for sending a system exclusive MIDI message. More... | |
virtual void | sendImpl (uint8_t rt, uint8_t cn)=0 |
Low-level function for sending a single-byte MIDI message. More... | |
Static Public Member Functions | |
static MIDI_Interface * | getDefault () |
Return the default MIDI interface. More... | |
Protected Member Functions | |
MIDI_Interface () | |
Constructor. More... | |
Static Private Attributes | |
static MIDI_Interface * | DefaultMIDI_Interface = nullptr |
An abstract class for MIDI interfaces.
Definition at line 16 of file MIDI_Interface.hpp.
|
protected |
Constructor.
Definition at line 5 of file MIDI_Interface.cpp.
|
virtual |
Destructor.
Definition at line 9 of file MIDI_Interface.cpp.
|
inlinevirtual |
Initialize the MIDI Interface.
Reimplemented in SerialMIDI_Interface< T >, SerialMIDI_Interface< HardwareSerial >, SerialMIDI_Interface< decltype(Serial)>, SerialMIDI_Interface< SoftwareSerial >, SerialDebugMIDI_Interface< T >, SerialDebugMIDI_Interface< HardwareSerial >, SerialDebugMIDI_Interface< decltype(Serial)>, SerialDebugMIDI_Interface< SoftwareSerial >, BluetoothMIDI_Interface, and MultiMIDI_Interface< N >.
Definition at line 32 of file MIDI_Interface.hpp.
void send | ( | uint8_t | m, |
uint8_t | c, | ||
uint8_t | d1, | ||
uint8_t | d2 | ||
) |
Send a 3-byte MIDI packet.
m | MIDI message type. [0x80, 0xE0] |
c | The MIDI channel. [1, 16] |
d1 | The first data byte. [0, 127] |
d2 | The second data byte. [0, 127] |
Definition at line 22 of file MIDI_Interface.cpp.
void send | ( | uint8_t | m, |
uint8_t | c, | ||
uint8_t | d1 | ||
) |
Send a 2-byte MIDI packet.
m | MIDI message type. [0x80, 0xE0] |
c | The MIDI channel. [1, 16] |
d1 | The first data byte. [0, 127] |
Definition at line 26 of file MIDI_Interface.cpp.
void sendOnCable | ( | uint8_t | m, |
uint8_t | c, | ||
uint8_t | d1, | ||
uint8_t | d2, | ||
uint8_t | cn | ||
) |
Send a 3-byte MIDI packet with cable number.
m | MIDI message type. [0x80, 0xE0] |
c | The MIDI channel. [1, 16] |
d1 | The first data byte. [0, 127] |
d2 | The second data byte. [0, 127] |
cn | The MIDI Cable Number. [0, 15] |
Definition at line 30 of file MIDI_Interface.cpp.
void sendOnCable | ( | uint8_t | m, |
uint8_t | c, | ||
uint8_t | d1, | ||
uint8_t | cn | ||
) |
Send a 2-byte MIDI packet with cable number.
m | MIDI message type. [0x80, 0xE0] |
c | The MIDI channel. [1, 16] |
d1 | The first data byte. [0, 127] |
cn | The MIDI Cable Number. [0, 15] |
Definition at line 42 of file MIDI_Interface.cpp.
void sendOnCable | ( | uint8_t | r, |
uint8_t | cn | ||
) |
Send a single-byte MIDI packet with cable number.
r | The MIDI byte to send. |
cn | The MIDI Cable Number. [0, 15] |
Definition at line 52 of file MIDI_Interface.cpp.
void sendNoteOn | ( | MIDICNChannelAddress | address, |
uint8_t | velocity | ||
) |
Send a MIDI Note On event.
Definition at line 58 of file MIDI_Interface.cpp.
void sendNoteOff | ( | MIDICNChannelAddress | address, |
uint8_t | velocity | ||
) |
Send a MIDI Note Off event.
Definition at line 64 of file MIDI_Interface.cpp.
void sendKP | ( | MIDICNChannelAddress | address, |
uint8_t | pressure | ||
) |
Send a MIDI Key Pressure event.
Definition at line 70 of file MIDI_Interface.cpp.
void sendCC | ( | MIDICNChannelAddress | address, |
uint8_t | value | ||
) |
Send a MIDI Control Change event.
Definition at line 75 of file MIDI_Interface.cpp.
void sendPC | ( | MIDICNChannelAddress | address | ) |
Send a MIDI Program Change event.
Definition at line 85 of file MIDI_Interface.cpp.
void sendPC | ( | MIDICNChannel | address, |
uint8_t | value | ||
) |
Send a MIDI Program Change event.
Definition at line 80 of file MIDI_Interface.cpp.
void sendCP | ( | MIDICNChannel | address, |
uint8_t | pressure | ||
) |
Send a MIDI Channel Pressure event.
Definition at line 90 of file MIDI_Interface.cpp.
void sendPB | ( | MIDICNChannel | address, |
uint16_t | value | ||
) |
Send a MIDI Pitch Bend event.
Definition at line 95 of file MIDI_Interface.cpp.
void send | ( | SysExMessage | message | ) |
Send a MIDI System Exclusive message.
Definition at line 100 of file MIDI_Interface.cpp.
|
inline |
Send a MIDI System Exclusive message.
Definition at line 120 of file MIDI_Interface.hpp.
void send | ( | uint8_t | rt, |
uint8_t | cn = 0 |
||
) |
Send a single-byte MIDI message.
Definition at line 109 of file MIDI_Interface.cpp.
|
pure virtual |
Read the MIDI interface and call the callback if a message is received.
Implemented in Parsing_MIDI_Interface, BluetoothMIDI_Interface, and MultiMIDI_Interface< N >.
|
static |
Return the default MIDI interface.
Definition at line 18 of file MIDI_Interface.cpp.
void setAsDefault | ( | ) |
Set this MIDI interface as the default interface.
Definition at line 16 of file MIDI_Interface.cpp.
|
pure virtual |
Set the callbacks that will be called when a MIDI message is received.
cb | A pointer to an object that implements the MIDI_Callbacks class. |
Implemented in Parsing_MIDI_Interface, and MultiMIDI_Interface< N >.
|
inline |
Set the callbacks that will be called when a MIDI message is received.
cb | A reference to an object that implements the MIDI_Callbacks class. |
Definition at line 159 of file MIDI_Interface.hpp.
|
pure virtual |
Low-level function for sending a 3-byte MIDI message.
Implemented in BluetoothMIDI_Interface, USBMIDI_Interface, MultiMIDI_Interface< N >, StreamMIDI_Interface, and StreamDebugMIDI_Interface.
|
pure virtual |
Low-level function for sending a 2-byte MIDI message.
Implemented in BluetoothMIDI_Interface, USBMIDI_Interface, MultiMIDI_Interface< N >, StreamMIDI_Interface, and StreamDebugMIDI_Interface.
|
pure virtual |
Low-level function for sending a system exclusive MIDI message.
Implemented in BluetoothMIDI_Interface, USBMIDI_Interface, MultiMIDI_Interface< N >, StreamMIDI_Interface, and StreamDebugMIDI_Interface.
|
pure virtual |
Low-level function for sending a single-byte MIDI message.
Implemented in BluetoothMIDI_Interface, USBMIDI_Interface, StreamMIDI_Interface, MultiMIDI_Interface< N >, and StreamDebugMIDI_Interface.
|
staticprivate |
Definition at line 182 of file MIDI_Interface.hpp.