Class that can send MIDI messages to a MIDI pipe. More...
#include <MIDI_Interfaces/MIDI_Pipes.hpp>
Public Member Functions | |
MIDI_Source ()=default | |
Default constructor. More... | |
MIDI_Source (const MIDI_Source &)=delete | |
Copy constructor (copying not allowed). More... | |
MIDI_Source & | operator= (const MIDI_Source &)=delete |
Copy assignment (copying not allowed). More... | |
MIDI_Source (MIDI_Source &&other) | |
Move constructor. More... | |
MIDI_Source & | operator= (MIDI_Source &&other) |
Move assignment. More... | |
virtual | ~MIDI_Source () |
Destructor. More... | |
Protected Attributes | |
MIDI_Pipe * | sinkPipe = nullptr |
Private Member Functions | |
virtual MIDI_Source * | getInitialSource () |
Base case for recursive function. More... | |
void | disconnectSinkPipesShallow () |
Disconnect only the first pipe connected to this source. More... | |
Sending data over a MIDI Pipe | |
void | sourceMIDItoPipe (ChannelMessage) |
Send a MIDI Channel Message. More... | |
void | sourceMIDItoPipe (SysExMessage) |
Send a MIDI System Exclusive message. More... | |
void | sourceMIDItoPipe (RealTimeMessage) |
Send a MIDI Real-Time message. More... | |
void | exclusive (cn_t cn, bool exclusive=true) |
Enter or exit exclusive mode for the given cable number. More... | |
bool | canWrite (cn_t cn) const |
Check if this source can write to the sinks it connects to. More... | |
Connecting and disconnecting MIDI Pipes | |
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 | disconnect (TrueMIDI_Sink &sink) |
Disconnect the given sink from this source. More... | |
bool | hasSinkPipe () const |
Check if this source is connected to a sink pipe. More... | |
Class that can send MIDI messages to a MIDI pipe.
Definition at line 125 of file MIDI_Pipes.hpp.
|
default |
Default constructor.
|
delete |
Copy constructor (copying not allowed).
MIDI_Source | ( | MIDI_Source && | other | ) |
Move constructor.
Definition at line 100 of file MIDI_Pipes.cpp.
|
virtual |
Destructor.
Definition at line 121 of file MIDI_Pipes.cpp.
void sourceMIDItoPipe | ( | ChannelMessage | msg | ) |
Send a MIDI Channel Message.
Definition at line 132 of file MIDI_Pipes.cpp.
void sourceMIDItoPipe | ( | SysExMessage | msg | ) |
Send a MIDI System Exclusive message.
Definition at line 137 of file MIDI_Pipes.cpp.
void sourceMIDItoPipe | ( | RealTimeMessage | msg | ) |
Send a MIDI Real-Time message.
Definition at line 142 of file MIDI_Pipes.cpp.
void exclusive | ( | cn_t | cn, |
bool | exclusive = true |
||
) |
Enter or exit exclusive mode for the given cable number.
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 exits exclusive mode until they can send again.
cn | Cable number to set the exclusive mode for [0, 15]. |
exclusive | True to enable exclusive mode, false to disable. |
Definition at line 123 of file MIDI_Pipes.cpp.
bool canWrite | ( | cn_t | cn | ) | const |
Check if this source can write to the sinks it connects to.
Returns false if any of the sinks have another source that is in exclusive mode.
cn | Cable number to check [0, 15]. |
Definition at line 128 of file MIDI_Pipes.cpp.
|
delete |
Copy assignment (copying not allowed).
MIDI_Source & operator= | ( | MIDI_Source && | other | ) |
Move assignment.
Definition at line 108 of file MIDI_Pipes.cpp.
void connectSinkPipe | ( | MIDI_Pipe * | sink | ) |
Fully connect a sink pipe to this source.
Definition at line 70 of file MIDI_Pipes.cpp.
void disconnectSinkPipes | ( | ) |
Disconnect all sink pipes that this source sinks to (recursively).
Definition at line 79 of file MIDI_Pipes.cpp.
bool disconnect | ( | TrueMIDI_Sink & | sink | ) |
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 94 of file MIDI_Pipes.cpp.
|
inline |
Check if this source is connected to a sink pipe.
Definition at line 189 of file MIDI_Pipes.hpp.
|
inlineprivatevirtual |
Base case for recursive function.
Reimplemented in MIDI_Pipe.
Definition at line 200 of file MIDI_Pipes.hpp.
|
private |
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 87 of file MIDI_Pipes.cpp.
|
protected |
Definition at line 209 of file MIDI_Pipes.hpp.