Control Surface disable-pipes
MIDI Control Surface library for Arduino
Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
TrueMIDI_SinkSource Struct Referenceabstract

#include <MIDI_Interfaces/MIDI_Pipes.hpp>

Detailed Description

A struct that is both a TrueMIDI_Sink and a TrueMIDI_Source.

Definition at line 589 of file MIDI_Pipes.hpp.

+ Inheritance diagram for TrueMIDI_SinkSource:
+ Collaboration diagram for TrueMIDI_SinkSource:

Sending data over a MIDI Pipe

virtual void sinkMIDIfromPipe (ChannelMessage)=0
 Accept an incoming MIDI Channel message. More...
 
virtual void sinkMIDIfromPipe (SysExMessage)=0
 Accept an incoming MIDI System Exclusive message. More...
 
virtual void sinkMIDIfromPipe (SysCommonMessage)=0
 Accept an incoming MIDI System Common message. More...
 
virtual void sinkMIDIfromPipe (RealTimeMessage)=0
 Accept an incoming MIDI Real-Time message. 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_PipegetSourcePipe ()
 Get a pointer to the pipe this sink 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...
 
MIDIStallergetStaller () 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_PipegetSinkPipe ()
 Get a pointer to the pipe this source is connected to, or nullptr if not connected. More...
 

Static Public Member Functions

static void swap (MIDI_Sink &a, MIDI_Sink &b)
 
static void swap (MIDI_Source &a, MIDI_Source &b)
 

Protected Attributes

MIDI_PipesourcePipe = nullptr
 
MIDI_PipesinkPipe = nullptr
 

Private Member Functions

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_SinkgetFinalSink ()
 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_SourcegetInitialSource ()
 Base case for recursive function. More...
 
void disconnectSinkPipesShallow ()
 Disconnect only the first pipe connected to this source. More...
 

Member Function Documentation

◆ sinkMIDIfromPipe() [1/4]

virtual void sinkMIDIfromPipe ( ChannelMessage  )
pure virtualinherited

Accept an incoming MIDI Channel message.

Implemented in StreamDebugMIDI_Output, Control_Surface_, MIDI_Interface, and MIDI_Pipe.

◆ sinkMIDIfromPipe() [2/4]

virtual void sinkMIDIfromPipe ( SysExMessage  )
pure virtualinherited

Accept an incoming MIDI System Exclusive message.

Implemented in StreamDebugMIDI_Output, Control_Surface_, MIDI_Interface, and MIDI_Pipe.

◆ sinkMIDIfromPipe() [3/4]

virtual void sinkMIDIfromPipe ( SysCommonMessage  )
pure virtualinherited

Accept an incoming MIDI System Common message.

Implemented in StreamDebugMIDI_Output, Control_Surface_, MIDI_Interface, and MIDI_Pipe.

◆ sinkMIDIfromPipe() [4/4]

virtual void sinkMIDIfromPipe ( RealTimeMessage  )
pure virtualinherited

Accept an incoming MIDI Real-Time message.

Implemented in StreamDebugMIDI_Output, Control_Surface_, MIDI_Interface, and MIDI_Pipe.

◆ connectSourcePipe()

void connectSourcePipe ( MIDI_Pipe source)
inherited

Fully connect a source pipe to this sink.

Definition at line 19 of file MIDI_Pipes.cpp.

◆ disconnectSourcePipes()

void disconnectSourcePipes ( )
inherited

Disconnect all source pipes that sink to this sink (recursively).

Definition at line 28 of file MIDI_Pipes.cpp.

◆ disconnect() [1/4]

bool disconnect ( TrueMIDI_Source source)
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 43 of file MIDI_Pipes.cpp.

◆ disconnect() [2/4]

bool disconnect ( MIDI_Pipe )
deleteinherited

◆ hasSourcePipe()

bool hasSourcePipe ( ) const
inlineinherited

Check if this sink is connected to a source pipe.

Definition at line 120 of file MIDI_Pipes.hpp.

◆ getSourcePipe()

MIDI_Pipe * getSourcePipe ( )
inlineinherited

Get a pointer to the pipe this sink is connected to, or nullptr if not connected.

Definition at line 123 of file MIDI_Pipes.hpp.

◆ stallDownstream()

virtual void stallDownstream ( MIDIStaller ,
MIDI_Source  
)
inlineprivatevirtualinherited

Base case for recursive stall function.

See also
MIDI_Pipe::stallDownstream

Reimplemented in MIDI_Pipe.

Definition at line 130 of file MIDI_Pipes.hpp.

◆ unstallDownstream()

virtual void unstallDownstream ( MIDIStaller ,
MIDI_Source  
)
inlineprivatevirtualinherited

Base case for recursive un-stall function.

See also
MIDI_Pipe::unstallDownstream

Reimplemented in MIDI_Pipe.

Definition at line 133 of file MIDI_Pipes.hpp.

◆ getFinalSink()

virtual MIDI_Sink * getFinalSink ( )
inlineprivatevirtualinherited

Base case for recursive function.

See also
MIDI_Pipe::getFinalSink

Reimplemented in MIDI_Pipe.

Definition at line 136 of file MIDI_Pipes.hpp.

◆ disconnectSourcePipesShallow()

void disconnectSourcePipesShallow ( )
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 36 of file MIDI_Pipes.cpp.

◆ swap() [1/2]

void swap ( MIDI_Sink a,
MIDI_Sink b 
)
staticinherited

Definition at line 59 of file MIDI_Pipes.cpp.

◆ sourceMIDItoPipe() [1/4]

void sourceMIDItoPipe ( ChannelMessage  msg)
inherited

Send a MIDI Channel Message down the pipe.

Definition at line 135 of file MIDI_Pipes.cpp.

◆ sourceMIDItoPipe() [2/4]

void sourceMIDItoPipe ( SysExMessage  msg)
inherited

Send a MIDI System Exclusive message down the pipe.

Definition at line 141 of file MIDI_Pipes.cpp.

◆ sourceMIDItoPipe() [3/4]

void sourceMIDItoPipe ( SysCommonMessage  msg)
inherited

Send a MIDI System Common message down the pipe.

Definition at line 147 of file MIDI_Pipes.cpp.

◆ sourceMIDItoPipe() [4/4]

void sourceMIDItoPipe ( RealTimeMessage  msg)
inherited

Send a MIDI Real-Time message down the pipe.

Definition at line 153 of file MIDI_Pipes.cpp.

◆ stall()

void stall ( MIDIStaller cause = eternal_stall)
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.

Parameters
causePointer to the reason for this stall, can be called back to un-stall the pipes.

Definition at line 160 of file MIDI_Pipes.cpp.

◆ unstall()

void unstall ( MIDIStaller cause = eternal_stall)
inherited

Un-stall the pipes connected to this source, so other sources are allowed to send again.

Parameters
causePointer to the reason for the stall (this has to be the same one that was used to stall).

Definition at line 165 of file MIDI_Pipes.cpp.

◆ isStalled()

bool isStalled ( ) const
inherited

Check if this source can write to the sinks it connects to.

Definition at line 170 of file MIDI_Pipes.cpp.

◆ getStaller()

MIDIStaller * getStaller ( ) const
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 176 of file MIDI_Pipes.cpp.

◆ getStallerName()

const char * getStallerName ( ) const
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 182 of file MIDI_Pipes.cpp.

◆ handleStallers()

void handleStallers ( ) const
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 186 of file MIDI_Pipes.cpp.

◆ connectSinkPipe()

void connectSinkPipe ( MIDI_Pipe sink)
inherited

Fully connect a sink pipe to this source.

Definition at line 78 of file MIDI_Pipes.cpp.

◆ disconnectSinkPipes()

void disconnectSinkPipes ( )
inherited

Disconnect all sink pipes that this source sinks to (recursively).

Definition at line 87 of file MIDI_Pipes.cpp.

◆ disconnect() [3/4]

bool disconnect ( TrueMIDI_Sink sink)
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 102 of file MIDI_Pipes.cpp.

◆ disconnect() [4/4]

bool disconnect ( MIDI_Pipe )
deleteinherited

◆ hasSinkPipe()

bool hasSinkPipe ( ) const
inlineinherited

Check if this source is connected to a sink pipe.

Definition at line 234 of file MIDI_Pipes.hpp.

◆ getSinkPipe()

MIDI_Pipe * getSinkPipe ( )
inlineinherited

Get a pointer to the pipe this source is connected to, or nullptr if not connected.

Definition at line 237 of file MIDI_Pipes.hpp.

◆ stallUpstream()

virtual void stallUpstream ( MIDIStaller ,
MIDI_Sink  
)
inlineprivatevirtualinherited

Base case for recursive stall function.

See also
MIDI_Pipe::stallUpstream

Reimplemented in MIDI_Pipe.

Definition at line 244 of file MIDI_Pipes.hpp.

◆ unstallUpstream()

virtual void unstallUpstream ( MIDIStaller ,
MIDI_Sink  
)
inlineprivatevirtualinherited

Base case for recursive un-stall function.

See also
MIDI_Pipe::unstallUpstream

Reimplemented in MIDI_Pipe.

Definition at line 247 of file MIDI_Pipes.hpp.

◆ getInitialSource()

virtual MIDI_Source * getInitialSource ( )
inlineprivatevirtualinherited

Base case for recursive function.

See also
MIDI_Pipe::getInitialSource

Reimplemented in MIDI_Pipe.

Definition at line 250 of file MIDI_Pipes.hpp.

◆ disconnectSinkPipesShallow()

void disconnectSinkPipesShallow ( )
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 95 of file MIDI_Pipes.cpp.

◆ swap() [2/2]

void swap ( MIDI_Source a,
MIDI_Source b 
)
staticinherited

Definition at line 116 of file MIDI_Pipes.cpp.

Member Data Documentation

◆ sourcePipe

MIDI_Pipe* sourcePipe = nullptr
protectedinherited

Definition at line 145 of file MIDI_Pipes.hpp.

◆ sinkPipe

MIDI_Pipe* sinkPipe = nullptr
protectedinherited

Definition at line 259 of file MIDI_Pipes.hpp.


The documentation for this struct was generated from the following file: