#include <MIDI_Interfaces/BluetoothMIDI_Interface.hpp>
Bluetooth Low Energy MIDI Interface for the ESP32.
Definition at line 29 of file BluetoothMIDI_Interface.hpp.
Default MIDI Interfaces | |
void | setAsDefault () |
Set this MIDI interface as the default interface. More... | |
static MIDI_Interface * | getDefault () |
Return the default MIDI interface. More... | |
MIDI Input Callbacks | |
void | setCallbacks (MIDI_Callbacks *cb) |
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... | |
Connecting and disconnecting MIDI Pipes | |
void | connectSourcePipe (MIDI_Pipe *source) |
Fully connect a source pipe to this sink. More... | |
void | disconnectSourcePipes () |
Disconnect all source pipes that sink to this sink (recursively). More... | |
bool | disconnect (TrueMIDI_Source &source) |
Disconnect the given source from this sink. More... | |
bool | disconnect (MIDI_Pipe &)=delete |
bool | hasSourcePipe () const |
Check if this sink is connected to a source pipe. More... | |
MIDI_Pipe * | getSourcePipe () |
Get a pointer to the pipe this sink is connected to, or nullptr if not connected. More... | |
Connecting and disconnecting MIDI Pipes | |
bool | disconnect (TrueMIDI_Sink &sink) |
Disconnect the given sink from this source. More... | |
bool | disconnect (MIDI_Pipe &)=delete |
void | connectSinkPipe (MIDI_Pipe *sink) |
Fully connect a sink pipe to this source. More... | |
void | disconnectSinkPipes () |
Disconnect all sink pipes that this source sinks to (recursively). More... | |
bool | hasSinkPipe () const |
Check if this source is connected to a sink pipe. More... | |
MIDI_Pipe * | getSinkPipe () |
Get a pointer to the pipe this source is connected to, or nullptr if not connected. More... | |
Sending data over a MIDI Pipe | |
void | sourceMIDItoPipe (ChannelMessage) |
Send a MIDI Channel Message down the pipe. More... | |
void | sourceMIDItoPipe (SysExMessage) |
Send a MIDI System Exclusive message down the pipe. More... | |
void | sourceMIDItoPipe (SysCommonMessage) |
Send a MIDI System Common message down the pipe. More... | |
void | sourceMIDItoPipe (RealTimeMessage) |
Send a MIDI Real-Time message down the pipe. More... | |
Stalling the sink pipes and exclusive access | |
void | stall (MIDIStaller *cause=eternal_stall) |
Stall this MIDI source. More... | |
void | unstall (MIDIStaller *cause=eternal_stall) |
Un-stall the pipes connected to this source, so other sources are allowed to send again. More... | |
bool | isStalled () const |
Check if this source can write to the sinks it connects to. More... | |
MIDIStaller * | getStaller () const |
Get a pointer to whatever is causing this MIDI source to be stalled. More... | |
const char * | getStallerName () const |
Get the name of whatever is causing this MIDI source to be stalled. More... | |
void | handleStallers () const |
Give the code that is stalling the MIDI sink pipes the opportunity to do its job and un-stall the pipes. More... | |
Sending MIDI Channel Voice messages | |
void | send (ChannelMessage message) |
Send a MIDI Channel Voice message. More... | |
void | sendChannelMessage (MIDIMessageType m, Channel c, uint8_t d1, uint8_t d2, Cable cable=CABLE_1) |
Send a 3-byte MIDI Channel Voice message. More... | |
void | sendChannelMessage (MIDIMessageType m, Channel c, uint8_t d1, Cable cable=CABLE_1) |
Send a 2-byte MIDI Channel Voice message. More... | |
void | sendNoteOn (MIDIAddress address, uint8_t velocity) |
Send a MIDI Note On event. More... | |
void | sendNoteOff (MIDIAddress address, uint8_t velocity) |
Send a MIDI Note Off event. More... | |
void | sendKeyPressure (MIDIAddress address, uint8_t pressure) |
Send a MIDI Key Pressure event. More... | |
void | sendControlChange (MIDIAddress address, uint8_t value) |
Send a MIDI Control Change event. More... | |
void | sendProgramChange (MIDIAddress address) |
Send a MIDI Program Change event. More... | |
void | sendProgramChange (MIDIChannelCable address, uint8_t value) |
Send a MIDI Program Change event. More... | |
void | sendChannelPressure (MIDIChannelCable address, uint8_t pressure) |
Send a MIDI Channel Pressure event. More... | |
void | sendPitchBend (MIDIChannelCable address, uint16_t value) |
Send a MIDI Pitch Bend event. More... | |
Sending MIDI System Common messages | |
void | send (SysCommonMessage message) |
Send a MIDI System Common message. More... | |
void | sendSysCommon (MIDIMessageType m, Cable cable=CABLE_1) |
Send a MIDI System Common message. More... | |
void | sendSysCommon (MIDIMessageType m, uint8_t data1, Cable cable=CABLE_1) |
Send a MIDI System Common message. More... | |
void | sendSysCommon (MIDIMessageType m, uint8_t data1, uint8_t data2, Cable cable=CABLE_1) |
Send a MIDI System Common message. More... | |
void | sendMTCQuarterFrame (uint8_t data, Cable cable=CABLE_1) |
Send a MIDI Time Code Quarter Frame. More... | |
void | sendMTCQuarterFrame (uint8_t messageType, uint8_t values, Cable cable=CABLE_1) |
Send a MIDI Time Code Quarter Frame. More... | |
void | sendSongPositionPointer (uint16_t spp, Cable cable=CABLE_1) |
Send a MIDI Song Position Pointer message. More... | |
void | sendSongSelect (uint8_t song, Cable cable=CABLE_1) |
Send a MIDI Song Select message. More... | |
void | sendTuneRequest (Cable cable=CABLE_1) |
Send a MIDI Tune Request. More... | |
Sending MIDI System Exclusive messages | |
void | send (SysExMessage message) |
Send a MIDI System Exclusive message. More... | |
void | sendSysEx (const uint8_t(&sysexdata)[N], Cable cable=CABLE_1) |
Send a MIDI System Exclusive message. More... | |
void | sendSysEx (const uint8_t *data, uint16_t length, Cable cable=CABLE_1) |
Send a MIDI System Exclusive message. More... | |
Sending MIDI Real-Time messages | |
void | send (RealTimeMessage message) |
Send a MIDI Real-Time message. More... | |
void | sendRealTime (MIDIMessageType rt, Cable cable=CABLE_1) |
Send a MIDI Real-Time message. More... | |
void | sendRealTime (uint8_t rt, Cable cable=CABLE_1) |
Send a MIDI Real-Time message. More... | |
void | sendTimingClock (Cable cable=CABLE_1) |
Send a MIDI Timing Clock message. More... | |
void | sendStart (Cable cable=CABLE_1) |
Send a MIDI Start message. More... | |
void | sendContinue (Cable cable=CABLE_1) |
Send a MIDI Continue message. More... | |
void | sendStop (Cable cable=CABLE_1) |
Send a MIDI Stop message. More... | |
void | sendActiveSensing (Cable cable=CABLE_1) |
Send a MIDI Active Sensing message. More... | |
void | sendSystemReset (Cable cable=CABLE_1) |
Send a MIDI System Reset message. More... | |
Flusing the MIDI send buffer | |
void | sendNow () |
Causes all buffered messages to be sent immediately. More... | |
Deprecated | |
void | sendKP (MIDIAddress address, uint8_t pressure) |
Send a MIDI Key Pressure event. More... | |
void | sendCC (MIDIAddress address, uint8_t value) |
Send a MIDI Control Change event. More... | |
void | sendPC (MIDIAddress address) |
Send a MIDI Program Change event. More... | |
void | sendPC (MIDIChannelCable address, uint8_t value) |
Send a MIDI Program Change event. More... | |
void | sendCP (MIDIChannelCable address, uint8_t pressure) |
Send a MIDI Channel Pressure event. More... | |
void | sendPB (MIDIChannelCable address, uint16_t value) |
Send a MIDI Pitch Bend event. More... | |
Enabling and disabling updatables | |
void | enable () |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More... | |
void | disable () |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More... | |
bool | isEnabled () const |
Check if this updatable is enabled. More... | |
void | moveDown () |
Move down this element in the list. More... | |
static void | enable (UpdatableCRTP *element) |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More... | |
static void | enable (UpdatableCRTP &element) |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More... | |
static void | enable (U(&array)[N]) |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More... | |
static void | disable (UpdatableCRTP *element) |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More... | |
static void | disable (UpdatableCRTP &element) |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More... | |
static void | disable (U(&array)[N]) |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More... | |
Main initialization and updating methods | |
static void | beginAll () |
Begin all enabled instances of this class. More... | |
static void | updateAll () |
Update all enabled instances of this class. More... | |
Public Member Functions | |
BluetoothMIDI_Interface () | |
~BluetoothMIDI_Interface () | |
void | flush () |
Send the buffered MIDI BLE packet immediately. More... | |
void | setTimeout (std::chrono::milliseconds timeout) |
Set the timeout, the number of milliseconds to buffer the outgoing MIDI messages. More... | |
void | setName (const char *name) |
Set the BLE device name. Must be called before begin(). More... | |
void | begin () override |
Initialize this updatable. More... | |
void | end () |
MIDIReadEvent | read () |
void | update () override |
Read the MIDI interface and call the callback if a message was received. More... | |
ChannelMessage | getChannelMessage () const |
Return the received channel voice message. More... | |
SysCommonMessage | getSysCommonMessage () const |
Return the received system common message. More... | |
RealTimeMessage | getRealTimeMessage () const |
Return the received real-time message. More... | |
SysExMessage | getSysExMessage () const |
Return the received system exclusive message. More... | |
uint16_t | getTimestamp () const |
Get the BLE-MIDI timestamp of the latest MIDI message. More... | |
void | parse (const uint8_t *const data, const size_t len) |
uint16_t | getMinMTU () const |
Get the minimum MTU of all connected clients. More... | |
void | forceMinMTU (uint16_t mtu) |
Force the MTU to an artificially small value (used for testing). More... | |
Static Public Member Functions | |
static void | midi_write_callback (const uint8_t *data, size_t length) |
static void | midi_mtu_callback (uint16_t mtu) |
template<class MIDIInterface_t > | |
static void | updateIncoming (MIDIInterface_t *iface) |
Read, parse and dispatch incoming MIDI messages on the given interface. More... | |
template<class MIDIInterface_t > | |
static void | dispatchIncoming (MIDIInterface_t *iface, MIDIReadEvent event) |
Dispatch the given type of MIDI message from the given interface. More... | |
template<class MIDIInterface_t > | |
static void | handleStall (MIDIInterface_t *iface) |
Un-stall the given MIDI interface. More... | |
static void | swap (MIDI_Sink &a, MIDI_Sink &b) |
static void | swap (MIDI_Source &a, MIDI_Source &b) |
Protected Member Functions | |
void | sendChannelMessageImpl (ChannelMessage) override |
Low-level function for sending a MIDI channel voice message. More... | |
void | sendSysCommonImpl (SysCommonMessage) override |
Low-level function for sending a MIDI system common message. More... | |
void | sendSysExImpl (SysExMessage) override |
Low-level function for sending a system exclusive MIDI message. More... | |
void | sendRealTimeImpl (RealTimeMessage) override |
Low-level function for sending a MIDI real-time message. More... | |
void | sendNowImpl () override |
Low-level function for sending any buffered outgoing MIDI messages. More... | |
void | sendChannelMessageImpl3Bytes (ChannelMessage) |
void | sendChannelMessageImpl2Bytes (ChannelMessage) |
void | sinkMIDIfromPipe (ChannelMessage msg) override |
Accept an incoming MIDI Channel message from the source pipe. More... | |
void | sinkMIDIfromPipe (SysExMessage msg) override |
Accept an incoming MIDI System Exclusive message from the source pipe. More... | |
void | sinkMIDIfromPipe (SysCommonMessage msg) override |
Accept an incoming MIDI System Common message from the source pipe. More... | |
void | sinkMIDIfromPipe (RealTimeMessage msg) override |
Accept an incoming MIDI Real-Time message from the source pipe. More... | |
void | onChannelMessage (ChannelMessage message) |
Call the channel message callback and send the message to the sink pipe. More... | |
void | onSysExMessage (SysExMessage message) |
Call the SysEx message callback and send the message to the sink pipe. More... | |
void | onSysCommonMessage (SysCommonMessage message) |
Call the System Common message callback and send the message to the sink pipe. More... | |
void | onRealTimeMessage (RealTimeMessage message) |
Call the real-time message callback and send the message to the sink pipe. More... | |
virtual const char * | getName () const |
Get the staller's name for debugging purposes. More... | |
Static Protected Member Functions | |
static const char * | getNameNull (MIDIStaller *s) |
Get the staller's name for debugging purposes. More... | |
Protected Attributes | |
MIDI_Pipe * | sourcePipe = nullptr |
MIDI_Pipe * | sinkPipe = nullptr |
Updatable< MIDI_Interface > * | next |
Updatable< MIDI_Interface > * | previous |
Static Protected Attributes | |
static DoublyLinkedList< Updatable< MIDI_Interface > > | updatables |
Private Types | |
using | lock_t = std::unique_lock< std::mutex > |
Lock type used to lock the mutex. More... | |
Private Member Functions | |
void | handleStall () override |
Call back that should finish any MIDI messages that are in progress, and un-stall the pipe or MIDI source as quickly as possible. More... | |
void | updateMTU (uint16_t mtu) |
Set the maximum transmission unit of the Bluetooth link. More... | |
void | startSendingThread () |
Launch a thread that sends the BLE packets in the background. More... | |
bool | handleSendEvents () |
Function that waits for BLE packets and sends them in the background. More... | |
void | flushImpl (lock_t &lock) |
Tell the background BLE sender thread to send the current packet. More... | |
void | stopSendingThread () |
Tell the background BLE sender thread to stop gracefully, and join it. More... | |
void | notifyMIDIBLE (const std::vector< uint8_t > &packet) |
virtual void | stallDownstream (MIDIStaller *, MIDI_Source *) |
Base case for recursive stall function. More... | |
virtual void | unstallDownstream (MIDIStaller *, MIDI_Source *) |
Base case for recursive un-stall function. More... | |
virtual MIDI_Sink * | getFinalSink () |
Base case for recursive function. More... | |
void | disconnectSourcePipesShallow () |
Disconnect only the first pipe connected to this sink. More... | |
virtual void | stallUpstream (MIDIStaller *, MIDI_Sink *) |
Base case for recursive stall function. More... | |
virtual void | unstallUpstream (MIDIStaller *, MIDI_Sink *) |
Base case for recursive un-stall function. More... | |
virtual MIDI_Source * | getInitialSource () |
Base case for recursive function. More... | |
void | disconnectSinkPipesShallow () |
Disconnect only the first pipe connected to this source. More... | |
Private Attributes | |
std::atomic_uint_fast16_t | min_mtu {23} |
The minimum MTU of all connected clients. More... | |
std::atomic_uint_fast16_t | force_min_mtu {0} |
Override the minimum MTU (0 means don't override, nonzero overrides if it's smaller than the minimum MTU of the clients). More... | |
SerialMIDI_Parser | parser {false} |
MIDI Parser for incoming data. More... | |
BLEMIDIPacketBuilder | packetbuilder |
Builds outgoing MIDI BLE packets. More... | |
MIDIMessageQueue | queue {64} |
Queue for incoming MIDI messages. More... | |
MIDIMessageQueue::MIDIMessageQueueElement | incomingMessage |
Incoming message that can be from retrieved using the getChannelMessage() , getSysCommonMessage() , getRealTimeMessage() and getSysExMessage() methods. More... | |
std::mutex | mtx |
Mutex to lock the MIDI BLE packet builder and the flush flag. More... | |
std::condition_variable | cv |
Condition variable used by the background sender thread to wait for data to send, and for the main thread to wait for the data to be flushed by the sender thread. More... | |
std::thread | send_thread |
Background thread that sends the actual MIDI BLE packets. More... | |
std::atomic_bool | stop_sending {false} |
Flag to stop the background thread. More... | |
bool | flushnow = false |
Flag to tell the sender thread to send the packet immediately. More... | |
std::chrono::milliseconds | timeout {10} |
Timeout before the sender thread sends a packet. More... | |
MIDI_Callbacks * | callbacks = nullptr |
Static Private Attributes | |
static BluetoothMIDI_Interface * | instance = nullptr |
Only one active instance. More... | |
static MIDI_Interface * | DefaultMIDI_Interface = nullptr |
|
private |
Lock type used to lock the mutex.
Definition at line 136 of file BluetoothMIDI_Interface.hpp.
|
inline |
Definition at line 32 of file BluetoothMIDI_Interface.hpp.
|
inline |
Definition at line 37 of file BluetoothMIDI_Interface.hpp.
|
inline |
Send the buffered MIDI BLE packet immediately.
Definition at line 45 of file BluetoothMIDI_Interface.hpp.
|
inline |
Set the timeout, the number of milliseconds to buffer the outgoing MIDI messages.
A shorter timeout usually results in lower latency, but also causes more overhead, because more packets might be required.
Definition at line 53 of file BluetoothMIDI_Interface.hpp.
void setName | ( | const char * | name | ) |
Set the BLE device name. Must be called before begin().
Definition at line 297 of file BluetoothMIDI_Interface.cpp.
|
overridevirtual |
Initialize this updatable.
Implements Updatable< MIDI_Interface >.
Definition at line 305 of file BluetoothMIDI_Interface.cpp.
void end | ( | ) |
Definition at line 318 of file BluetoothMIDI_Interface.cpp.
MIDIReadEvent read | ( | ) |
Definition at line 228 of file BluetoothMIDI_Interface.cpp.
|
inlineoverridevirtual |
Read the MIDI interface and call the callback if a message was received.
Implements MIDI_Interface.
Definition at line 67 of file BluetoothMIDI_Interface.hpp.
|
inlineoverrideprivatevirtual |
Call back that should finish any MIDI messages that are in progress, and un-stall the pipe or MIDI source as quickly as possible.
Implements MIDIStaller.
Definition at line 70 of file BluetoothMIDI_Interface.hpp.
ChannelMessage getChannelMessage | ( | ) | const |
Return the received channel voice message.
Definition at line 235 of file BluetoothMIDI_Interface.cpp.
SysCommonMessage getSysCommonMessage | ( | ) | const |
Return the received system common message.
Definition at line 241 of file BluetoothMIDI_Interface.cpp.
RealTimeMessage getRealTimeMessage | ( | ) | const |
Return the received real-time message.
Definition at line 247 of file BluetoothMIDI_Interface.cpp.
SysExMessage getSysExMessage | ( | ) | const |
Return the received system exclusive message.
Definition at line 253 of file BluetoothMIDI_Interface.cpp.
uint16_t getTimestamp | ( | ) | const |
Get the BLE-MIDI timestamp of the latest MIDI message.
Definition at line 261 of file BluetoothMIDI_Interface.cpp.
|
overrideprotectedvirtual |
Low-level function for sending a MIDI channel voice message.
Implements MIDI_Interface.
Definition at line 95 of file BluetoothMIDI_Interface.cpp.
|
overrideprotectedvirtual |
Low-level function for sending a MIDI system common message.
Implements MIDI_Interface.
Definition at line 144 of file BluetoothMIDI_Interface.cpp.
|
overrideprotectedvirtual |
Low-level function for sending a system exclusive MIDI message.
Implements MIDI_Interface.
Definition at line 160 of file BluetoothMIDI_Interface.cpp.
|
overrideprotectedvirtual |
Low-level function for sending a MIDI real-time message.
Implements MIDI_Interface.
Definition at line 131 of file BluetoothMIDI_Interface.cpp.
|
inlineoverrideprotectedvirtual |
Low-level function for sending any buffered outgoing MIDI messages.
Implements MIDI_Interface.
Definition at line 91 of file BluetoothMIDI_Interface.hpp.
|
protected |
Definition at line 100 of file BluetoothMIDI_Interface.cpp.
|
protected |
Definition at line 118 of file BluetoothMIDI_Interface.cpp.
void parse | ( | const uint8_t *const | data, |
const size_t | len | ||
) |
Definition at line 192 of file BluetoothMIDI_Interface.cpp.
|
private |
Set the maximum transmission unit of the Bluetooth link.
Used to compute the MIDI BLE packet size.
Definition at line 267 of file BluetoothMIDI_Interface.cpp.
|
inline |
Get the minimum MTU of all connected clients.
Definition at line 113 of file BluetoothMIDI_Interface.hpp.
void forceMinMTU | ( | uint16_t | mtu | ) |
Force the MTU to an artificially small value (used for testing).
Definition at line 279 of file BluetoothMIDI_Interface.cpp.
|
private |
Launch a thread that sends the BLE packets in the background.
Definition at line 13 of file BluetoothMIDI_Interface.cpp.
|
private |
Function that waits for BLE packets and sends them in the background.
It either sends them after a timeout (a given number of milliseconds after the first data was added to the packet), or immediately when it receives a flush signal from the main thread.
Definition at line 25 of file BluetoothMIDI_Interface.cpp.
|
private |
Tell the background BLE sender thread to send the current packet.
Blocks until the packet is sent.
lock | Lock should be locked at entry, will still be locked on exit. |
Definition at line 50 of file BluetoothMIDI_Interface.cpp.
|
private |
Tell the background BLE sender thread to stop gracefully, and join it.
Definition at line 67 of file BluetoothMIDI_Interface.cpp.
|
inlinestatic |
Definition at line 177 of file BluetoothMIDI_Interface.hpp.
|
inlinestatic |
Definition at line 182 of file BluetoothMIDI_Interface.hpp.
|
private |
Definition at line 85 of file BluetoothMIDI_Interface.cpp.
|
inherited |
Set this MIDI interface as the default interface.
Definition at line 15 of file MIDI_Interface.cpp.
|
staticinherited |
Return the default MIDI interface.
If the default MIDI interface was configured explicitly using setAsDefault(), that interface is returned. If it wasn't set, or if that MIDI interface no longer exists, this function returns the newest MIDI interface, the one that was constructed most recently. If no MIDI interfaces exist, nullptr
is returned.
Definition at line 23 of file MIDI_Interface.cpp.
|
inlineinherited |
Set the callbacks that will be called when a MIDI message is received.
cb | A pointer to the callback object. |
Definition at line 58 of file MIDI_Interface.hpp.
|
inlineinherited |
Set the callbacks that will be called when a MIDI message is received.
cb | A reference to the callback object. |
Definition at line 62 of file MIDI_Interface.hpp.
|
inlineoverrideprotectedvirtualinherited |
Accept an incoming MIDI Channel message from the source pipe.
Implements MIDI_Sink.
Definition at line 81 of file MIDI_Interface.hpp.
|
inlineoverrideprotectedvirtualinherited |
Accept an incoming MIDI System Exclusive message from the source pipe.
Implements MIDI_Sink.
Definition at line 83 of file MIDI_Interface.hpp.
|
inlineoverrideprotectedvirtualinherited |
Accept an incoming MIDI System Common message from the source pipe.
Implements MIDI_Sink.
Definition at line 85 of file MIDI_Interface.hpp.
|
inlineoverrideprotectedvirtualinherited |
Accept an incoming MIDI Real-Time message from the source pipe.
Implements MIDI_Sink.
Definition at line 87 of file MIDI_Interface.hpp.
|
protectedinherited |
Call the channel message callback and send the message to the sink pipe.
Definition at line 35 of file MIDI_Interface.cpp.
|
protectedinherited |
Call the SysEx message callback and send the message to the sink pipe.
Definition at line 41 of file MIDI_Interface.cpp.
|
protectedinherited |
Call the System Common message callback and send the message to the sink pipe.
Definition at line 47 of file MIDI_Interface.cpp.
|
protectedinherited |
Call the real-time message callback and send the message to the sink pipe.
Definition at line 53 of file MIDI_Interface.cpp.
|
staticinherited |
Read, parse and dispatch incoming MIDI messages on the given interface.
Definition at line 122 of file MIDI_Interface.hpp.
|
staticinherited |
Dispatch the given type of MIDI message from the given interface.
Definition at line 143 of file MIDI_Interface.hpp.
|
staticinherited |
Un-stall the given MIDI interface.
Assumes the interface has been stalled because of a chunked SysEx messages. Waits untill that message is finished.
Definition at line 165 of file MIDI_Interface.hpp.
|
inherited |
Fully connect a source pipe to this sink.
Definition at line 16 of file MIDI_Pipes.cpp.
|
inherited |
Disconnect all source pipes that sink to this sink (recursively).
Definition at line 25 of file MIDI_Pipes.cpp.
|
inherited |
Disconnect the given source from this sink.
Leaves other sources connected. Returns true if the source was found and disconnected, false if the given source was not a direct or indirect source to this sink.
Definition at line 40 of file MIDI_Pipes.cpp.
|
deleteinherited |
|
inherited |
Disconnect the given sink from this source.
Leaves other sinks connected. Returns true if the sink was found and disconnected, false if the given sink was not a direct or indirect sink of this source.
Definition at line 99 of file MIDI_Pipes.cpp.
|
deleteinherited |
|
inlineinherited |
Check if this sink is connected to a source pipe.
Definition at line 117 of file MIDI_Pipes.hpp.
|
inlineinherited |
Get a pointer to the pipe this sink is connected to, or nullptr
if not connected.
Definition at line 120 of file MIDI_Pipes.hpp.
|
inlineprivatevirtualinherited |
Base case for recursive stall function.
Reimplemented in MIDI_Pipe.
Definition at line 127 of file MIDI_Pipes.hpp.
|
inlineprivatevirtualinherited |
Base case for recursive un-stall function.
Reimplemented in MIDI_Pipe.
Definition at line 130 of file MIDI_Pipes.hpp.
|
inlineprivatevirtualinherited |
Base case for recursive function.
Reimplemented in MIDI_Pipe.
Definition at line 133 of file MIDI_Pipes.hpp.
|
privateinherited |
Disconnect only the first pipe connected to this sink.
Leaves the other pipes connected to the original pipe, which doesn't have a sink anymore when this function finishes. Used to disconnect a MIDI_Pipe while preserving the connections of its “through” inputs.
Definition at line 33 of file MIDI_Pipes.cpp.
Definition at line 56 of file MIDI_Pipes.cpp.
|
staticinherited |
Definition at line 113 of file MIDI_Pipes.cpp.
|
inherited |
Send a MIDI Channel Message down the pipe.
Definition at line 132 of file MIDI_Pipes.cpp.
|
inherited |
Send a MIDI System Exclusive message down the pipe.
Definition at line 138 of file MIDI_Pipes.cpp.
|
inherited |
Send a MIDI System Common message down the pipe.
Definition at line 144 of file MIDI_Pipes.cpp.
|
inherited |
Send a MIDI Real-Time message down the pipe.
Definition at line 150 of file MIDI_Pipes.cpp.
|
inherited |
Stall this MIDI source.
This means that this becomes the only source that can sink to the sinks connected to this source. Other sources have to wait until this source un-stalls the pipe before they can send again.
cause | Pointer to the reason for this stall, can be called back to un-stall the pipes. |
Definition at line 157 of file MIDI_Pipes.cpp.
|
inherited |
Un-stall the pipes connected to this source, so other sources are allowed to send again.
cause | Pointer to the reason for the stall (this has to be the same one that was used to stall). |
Definition at line 162 of file MIDI_Pipes.cpp.
|
inherited |
Check if this source can write to the sinks it connects to.
Definition at line 167 of file MIDI_Pipes.cpp.
|
inherited |
Get a pointer to whatever is causing this MIDI source to be stalled.
There could be multiple stallers, this function just returns one.
Definition at line 173 of file MIDI_Pipes.cpp.
|
inherited |
Get the name of whatever is causing this MIDI source to be stalled.
There could be multiple stallers, this function just returns one.
Definition at line 179 of file MIDI_Pipes.cpp.
|
inherited |
Give the code that is stalling the MIDI sink pipes the opportunity to do its job and un-stall the pipes.
Definition at line 183 of file MIDI_Pipes.cpp.
|
inherited |
Fully connect a sink pipe to this source.
Definition at line 75 of file MIDI_Pipes.cpp.
|
inherited |
Disconnect all sink pipes that this source sinks to (recursively).
Definition at line 84 of file MIDI_Pipes.cpp.
|
inlineinherited |
Check if this source is connected to a sink pipe.
Definition at line 231 of file MIDI_Pipes.hpp.
|
inlineinherited |
Get a pointer to the pipe this source is connected to, or nullptr
if not connected.
Definition at line 234 of file MIDI_Pipes.hpp.
|
inlineprivatevirtualinherited |
Base case for recursive stall function.
Reimplemented in MIDI_Pipe.
Definition at line 241 of file MIDI_Pipes.hpp.
|
inlineprivatevirtualinherited |
Base case for recursive un-stall function.
Reimplemented in MIDI_Pipe.
Definition at line 244 of file MIDI_Pipes.hpp.
|
inlineprivatevirtualinherited |
Base case for recursive function.
Reimplemented in MIDI_Pipe.
Definition at line 247 of file MIDI_Pipes.hpp.
|
privateinherited |
Disconnect only the first pipe connected to this source.
Leaves the other pipes connected to the original pipe, which doesn't have a source anymore when this function finishes. Used to disconnect a MIDI_Pipe while preserving the connections of its “through” outputs.
Definition at line 92 of file MIDI_Pipes.cpp.
|
inherited |
Send a MIDI Channel Voice message.
Definition at line 17 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI System Common message.
Definition at line 74 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI System Exclusive message.
Definition at line 101 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Real-Time message.
Definition at line 114 of file MIDI_Sender.ipp.
|
inherited |
Send a 3-byte MIDI Channel Voice message.
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] |
cable | The MIDI Cable Number. [CABLE_1, CABLE_16] |
Definition at line 33 of file MIDI_Sender.ipp.
|
inherited |
Send a 2-byte MIDI Channel Voice message.
m | MIDI message type. [0x80, 0xE0] |
c | The MIDI channel. [1, 16] |
d1 | The first data byte. [0, 127] |
cable | The MIDI Cable Number. [1, 16] |
Definition at line 48 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Note On event.
Definition at line 52 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Note Off event.
Definition at line 54 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Key Pressure event.
Definition at line 56 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Control Change event.
Definition at line 58 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Program Change event.
Definition at line 60 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Program Change event.
Definition at line 62 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Channel Pressure event.
Definition at line 64 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Pitch Bend event.
Definition at line 66 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI System Common message.
Definition at line 76 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI System Common message.
Definition at line 78 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI System Common message.
Definition at line 80 of file MIDI_Sender.ipp.
Send a MIDI Time Code Quarter Frame.
Definition at line 84 of file MIDI_Sender.ipp.
Send a MIDI Time Code Quarter Frame.
Definition at line 86 of file MIDI_Sender.ipp.
Send a MIDI Song Position Pointer message.
Definition at line 89 of file MIDI_Sender.ipp.
Send a MIDI Song Select message.
Definition at line 91 of file MIDI_Sender.ipp.
Send a MIDI Tune Request.
Definition at line 93 of file MIDI_Sender.ipp.
Send a MIDI System Exclusive message.
Definition at line 104 of file MIDI_Sender.ipp.
Send a MIDI System Exclusive message.
Definition at line 106 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Real-Time message.
Definition at line 116 of file MIDI_Sender.ipp.
Send a MIDI Real-Time message.
Definition at line 118 of file MIDI_Sender.ipp.
Send a MIDI Timing Clock message.
Definition at line 121 of file MIDI_Sender.ipp.
Send a MIDI Start message.
Definition at line 123 of file MIDI_Sender.ipp.
Send a MIDI Continue message.
Definition at line 125 of file MIDI_Sender.ipp.
Send a MIDI Stop message.
Definition at line 127 of file MIDI_Sender.ipp.
Send a MIDI Active Sensing message.
Definition at line 129 of file MIDI_Sender.ipp.
Send a MIDI System Reset message.
Definition at line 131 of file MIDI_Sender.ipp.
|
inherited |
Causes all buffered messages to be sent immediately.
Definition at line 142 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Key Pressure event.
Definition at line 152 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Control Change event.
Definition at line 156 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Program Change event.
Definition at line 160 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Program Change event.
Definition at line 164 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Channel Pressure event.
Definition at line 168 of file MIDI_Sender.ipp.
|
inherited |
Send a MIDI Pitch Bend event.
Definition at line 172 of file MIDI_Sender.ipp.
|
inlinestaticinherited |
Begin all enabled instances of this class.
Definition at line 186 of file Updatable.hpp.
|
inlinestaticinherited |
Update all enabled instances of this class.
Definition at line 190 of file Updatable.hpp.
|
inlineinherited |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 100 of file Updatable.hpp.
|
inlinestaticinherited |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 129 of file Updatable.hpp.
|
inlinestaticinherited |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 131 of file Updatable.hpp.
|
inlinestaticinherited |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 134 of file Updatable.hpp.
|
inlineinherited |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 110 of file Updatable.hpp.
|
inlinestaticinherited |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 140 of file Updatable.hpp.
|
inlinestaticinherited |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 142 of file Updatable.hpp.
|
inlinestaticinherited |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 145 of file Updatable.hpp.
|
inlineinherited |
Check if this updatable is enabled.
Definition at line 124 of file Updatable.hpp.
|
inlineinherited |
Move down this element in the list.
Definition at line 151 of file Updatable.hpp.
|
inlinevirtualinherited |
Get the staller's name for debugging purposes.
Definition at line 15 of file MIDI_Staller.hpp.
|
staticinherited |
Get the staller's name for debugging purposes.
Correctly deals with null pointers or eternal stallers.
Definition at line 354 of file MIDI_Pipes.cpp.
|
private |
The minimum MTU of all connected clients.
Definition at line 101 of file BluetoothMIDI_Interface.hpp.
|
private |
Override the minimum MTU (0 means don't override, nonzero overrides if it's smaller than the minimum MTU of the clients).
Definition at line 105 of file BluetoothMIDI_Interface.hpp.
|
staticprivate |
Only one active instance.
Definition at line 120 of file BluetoothMIDI_Interface.hpp.
|
private |
MIDI Parser for incoming data.
Definition at line 122 of file BluetoothMIDI_Interface.hpp.
|
private |
Builds outgoing MIDI BLE packets.
Definition at line 124 of file BluetoothMIDI_Interface.hpp.
|
private |
Queue for incoming MIDI messages.
Definition at line 126 of file BluetoothMIDI_Interface.hpp.
|
private |
Incoming message that can be from retrieved using the getChannelMessage()
, getSysCommonMessage()
, getRealTimeMessage()
and getSysExMessage()
methods.
Definition at line 130 of file BluetoothMIDI_Interface.hpp.
|
private |
Mutex to lock the MIDI BLE packet builder and the flush flag.
Definition at line 138 of file BluetoothMIDI_Interface.hpp.
|
private |
Condition variable used by the background sender thread to wait for data to send, and for the main thread to wait for the data to be flushed by the sender thread.
Definition at line 142 of file BluetoothMIDI_Interface.hpp.
|
private |
Background thread that sends the actual MIDI BLE packets.
Definition at line 144 of file BluetoothMIDI_Interface.hpp.
|
private |
Flag to stop the background thread.
Definition at line 146 of file BluetoothMIDI_Interface.hpp.
|
private |
Flag to tell the sender thread to send the packet immediately.
Definition at line 148 of file BluetoothMIDI_Interface.hpp.
|
private |
Timeout before the sender thread sends a packet.
Definition at line 151 of file BluetoothMIDI_Interface.hpp.
|
privateinherited |
Definition at line 115 of file MIDI_Interface.hpp.
|
staticprivateinherited |
Definition at line 118 of file MIDI_Interface.hpp.
|
protectedinherited |
Definition at line 142 of file MIDI_Pipes.hpp.
|
protectedinherited |
Definition at line 256 of file MIDI_Pipes.hpp.
|
staticprotectedinherited |
Definition at line 156 of file Updatable.hpp.
|
protectedinherited |
Definition at line 324 of file LinkedList.hpp.
|
protectedinherited |
Definition at line 325 of file LinkedList.hpp.