Control Surface  1.2.0
MIDI Control Surface library for Arduino
Protected Attributes | Private Member Functions | List of all members
TrueMIDI_SinkSource Struct Referenceabstract

A struct that is both a TrueMIDI_Sink and a TrueMIDI_Source. More...

#include <MIDI_Interfaces/MIDI_Pipes.hpp>

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

Protected Attributes

MIDI_PipesourcePipe = nullptr
 
MIDI_PipesinkPipe = nullptr
 

Private Member Functions

virtual void lockDownstream (cn_t cn, bool lock)
 Base case for recursive lock function. More...
 
virtual MIDI_SinkgetFinalSink ()
 Base case for recursive function. More...
 
void disconnectSourcePipesShallow ()
 Disconnect only the first pipe connected to this sink. More...
 
virtual MIDI_SourcegetInitialSource ()
 Base case for recursive function. More...
 
void disconnectSinkPipesShallow ()
 Disconnect only the first pipe connected to this source. More...
 

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 (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 hasSourcePipe () const
 Check if this sink is connected to a source pipe. 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...
 

Detailed Description

A struct that is both a TrueMIDI_Sink and a TrueMIDI_Source.

Definition at line 501 of file MIDI_Pipes.hpp.

Member Function Documentation

◆ sinkMIDIfromPipe() [1/3]

virtual void sinkMIDIfromPipe ( ChannelMessage  )
pure virtualinherited

Accept an incoming MIDI Channel message.

Implemented in MIDI_Interface, MIDI_Pipe, and Control_Surface_.

◆ sinkMIDIfromPipe() [2/3]

virtual void sinkMIDIfromPipe ( SysExMessage  )
pure virtualinherited

Accept an incoming MIDI System Exclusive message.

Implemented in MIDI_Interface, MIDI_Pipe, and Control_Surface_.

◆ sinkMIDIfromPipe() [3/3]

virtual void sinkMIDIfromPipe ( RealTimeMessage  )
pure virtualinherited

Accept an incoming MIDI Real-Time message.

Implemented in MIDI_Interface, MIDI_Pipe, and Control_Surface_.

◆ connectSourcePipe()

void connectSourcePipe ( MIDI_Pipe source)
inherited

Fully connect a source pipe to this sink.

Definition at line 15 of file MIDI_Pipes.cpp.

◆ disconnectSourcePipes()

void disconnectSourcePipes ( )
inherited

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

Definition at line 24 of file MIDI_Pipes.cpp.

◆ disconnect() [1/2]

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 39 of file MIDI_Pipes.cpp.

◆ hasSourcePipe()

bool hasSourcePipe ( ) const
inlineinherited

Check if this sink is connected to a source pipe.

Definition at line 94 of file MIDI_Pipes.hpp.

◆ lockDownstream()

virtual void lockDownstream ( cn_t  cn,
bool  lock 
)
inlineprivatevirtualinherited

Base case for recursive lock function.

See also
MIDI_Pipe::lockDownstream

Reimplemented in MIDI_Pipe.

Definition at line 105 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 108 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 32 of file MIDI_Pipes.cpp.

◆ sourceMIDItoPipe() [1/3]

void sourceMIDItoPipe ( ChannelMessage  msg)
inherited

Send a MIDI Channel Message.

Definition at line 132 of file MIDI_Pipes.cpp.

◆ sourceMIDItoPipe() [2/3]

void sourceMIDItoPipe ( SysExMessage  msg)
inherited

Send a MIDI System Exclusive message.

Definition at line 137 of file MIDI_Pipes.cpp.

◆ sourceMIDItoPipe() [3/3]

void sourceMIDItoPipe ( RealTimeMessage  msg)
inherited

Send a MIDI Real-Time message.

Definition at line 142 of file MIDI_Pipes.cpp.

◆ exclusive()

void exclusive ( cn_t  cn,
bool  exclusive = true 
)
inherited

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.

Parameters
cnCable number to set the exclusive mode for [0, 15].
exclusiveTrue to enable exclusive mode, false to disable.

Definition at line 123 of file MIDI_Pipes.cpp.

◆ canWrite()

bool canWrite ( cn_t  cn) const
inherited

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.

Parameters
cnCable number to check [0, 15].

Definition at line 128 of file MIDI_Pipes.cpp.

◆ connectSinkPipe()

void connectSinkPipe ( MIDI_Pipe sink)
inherited

Fully connect a sink pipe to this source.

Definition at line 70 of file MIDI_Pipes.cpp.

◆ disconnectSinkPipes()

void disconnectSinkPipes ( )
inherited

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

Definition at line 79 of file MIDI_Pipes.cpp.

◆ disconnect() [2/2]

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 94 of file MIDI_Pipes.cpp.

◆ hasSinkPipe()

bool hasSinkPipe ( ) const
inlineinherited

Check if this source is connected to a sink pipe.

Definition at line 189 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 200 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 87 of file MIDI_Pipes.cpp.

Member Data Documentation

◆ sourcePipe

MIDI_Pipe* sourcePipe = nullptr
protectedinherited

Definition at line 117 of file MIDI_Pipes.hpp.

◆ sinkPipe

MIDI_Pipe* sinkPipe = nullptr
protectedinherited

Definition at line 209 of file MIDI_Pipes.hpp.


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