#include <MIDI_Interfaces/MIDI_Pipes.hpp>
Class that can send MIDI messages to a MIDI pipe.
Definition at line 154 of file MIDI_Pipes.hpp.
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... | |
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 | disconnect (MIDI_Pipe &)=delete |
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... | |
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... | |
Static Public Member Functions | |
static void | swap (MIDI_Source &a, MIDI_Source &b) |
Protected Attributes | |
MIDI_Pipe * | sinkPipe = nullptr |
Private Member Functions | |
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... | |
|
default |
Default constructor.
|
delete |
Copy constructor (copying not allowed).
MIDI_Source | ( | MIDI_Source && | other | ) |
Move constructor.
Definition at line 105 of file MIDI_Pipes.cpp.
|
virtual |
Destructor.
Definition at line 130 of file MIDI_Pipes.cpp.
|
delete |
Copy assignment (copying not allowed).
MIDI_Source & operator= | ( | MIDI_Source && | other | ) |
Move assignment.
Definition at line 125 of file MIDI_Pipes.cpp.
void sourceMIDItoPipe | ( | ChannelMessage | msg | ) |
Send a MIDI Channel Message down the pipe.
Definition at line 132 of file MIDI_Pipes.cpp.
void sourceMIDItoPipe | ( | SysExMessage | msg | ) |
Send a MIDI System Exclusive message down the pipe.
Definition at line 138 of file MIDI_Pipes.cpp.
void sourceMIDItoPipe | ( | SysCommonMessage | msg | ) |
Send a MIDI System Common message down the pipe.
Definition at line 144 of file MIDI_Pipes.cpp.
void sourceMIDItoPipe | ( | RealTimeMessage | msg | ) |
Send a MIDI Real-Time message down the pipe.
Definition at line 150 of file MIDI_Pipes.cpp.
void stall | ( | MIDIStaller * | cause = eternal_stall | ) |
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.
void unstall | ( | MIDIStaller * | cause = eternal_stall | ) |
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.
bool isStalled | ( | ) | const |
Check if this source can write to the sinks it connects to.
Definition at line 167 of file MIDI_Pipes.cpp.
MIDIStaller * getStaller | ( | ) | const |
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.
const char * getStallerName | ( | ) | const |
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.
void handleStallers | ( | ) | const |
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.
void connectSinkPipe | ( | MIDI_Pipe * | sink | ) |
Fully connect a sink pipe to this source.
Definition at line 75 of file MIDI_Pipes.cpp.
void disconnectSinkPipes | ( | ) |
Disconnect all sink pipes that this source sinks to (recursively).
Definition at line 84 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 99 of file MIDI_Pipes.cpp.
|
delete |
|
inline |
Check if this source is connected to a sink pipe.
Definition at line 231 of file MIDI_Pipes.hpp.
|
inline |
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.
|
inlineprivatevirtual |
Base case for recursive stall function.
Reimplemented in MIDI_Pipe.
Definition at line 241 of file MIDI_Pipes.hpp.
|
inlineprivatevirtual |
Base case for recursive un-stall function.
Reimplemented in MIDI_Pipe.
Definition at line 244 of file MIDI_Pipes.hpp.
|
inlineprivatevirtual |
Base case for recursive function.
Reimplemented in MIDI_Pipe.
Definition at line 247 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 92 of file MIDI_Pipes.cpp.
|
static |
Definition at line 113 of file MIDI_Pipes.cpp.
|
protected |
Definition at line 256 of file MIDI_Pipes.hpp.