Control Surface master
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | List of all members
MIDI_Sink Class Referenceabstract

#include <MIDI_Interfaces/MIDI_Pipes.hpp>

Detailed Description

Receives MIDI messages from a MIDI pipe.

Definition at line 71 of file MIDI_Pipes.hpp.

+ Inheritance diagram for MIDI_Sink:
+ Collaboration diagram for MIDI_Sink:

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...
 

Public Member Functions

 MIDI_Sink ()=default
 Default constructor. More...
 
 MIDI_Sink (const MIDI_Sink &)=delete
 Copy constructor (copying not allowed). More...
 
MIDI_Sinkoperator= (const MIDI_Sink &)=delete
 Copy assignment (copying not allowed). More...
 
 MIDI_Sink (MIDI_Sink &&other)
 Move constructor. More...
 
MIDI_Sinkoperator= (MIDI_Sink &&other)
 Move assignment. More...
 
virtual ~MIDI_Sink ()
 Destructor. More...
 

Static Public Member Functions

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

Protected Attributes

MIDI_PipesourcePipe = 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...
 

Constructor & Destructor Documentation

◆ MIDI_Sink() [1/3]

MIDI_Sink ( )
default

Default constructor.

◆ MIDI_Sink() [2/3]

MIDI_Sink ( const MIDI_Sink )
delete

Copy constructor (copying not allowed).

◆ MIDI_Sink() [3/3]

MIDI_Sink ( MIDI_Sink &&  other)

Move constructor.

Definition at line 48 of file MIDI_Pipes.cpp.

◆ ~MIDI_Sink()

~MIDI_Sink ( )
virtual

Destructor.

Definition at line 46 of file MIDI_Pipes.cpp.

Member Function Documentation

◆ operator=() [1/2]

MIDI_Sink & operator= ( const MIDI_Sink )
delete

Copy assignment (copying not allowed).

◆ operator=() [2/2]

MIDI_Sink & operator= ( MIDI_Sink &&  other)

Move assignment.

Definition at line 68 of file MIDI_Pipes.cpp.

◆ sinkMIDIfromPipe() [1/4]

virtual void sinkMIDIfromPipe ( ChannelMessage  )
pure virtual

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 virtual

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 virtual

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 virtual

Accept an incoming MIDI Real-Time message.

Implemented in StreamDebugMIDI_Output, Control_Surface_, MIDI_Interface, and MIDI_Pipe.

◆ connectSourcePipe()

void connectSourcePipe ( MIDI_Pipe source)

Fully connect a source pipe to this sink.

Definition at line 16 of file MIDI_Pipes.cpp.

◆ disconnectSourcePipes()

void disconnectSourcePipes ( )

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

Definition at line 25 of file MIDI_Pipes.cpp.

◆ disconnect() [1/2]

bool disconnect ( TrueMIDI_Source source)

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.

◆ disconnect() [2/2]

bool disconnect ( MIDI_Pipe )
delete

◆ hasSourcePipe()

bool hasSourcePipe ( ) const
inline

Check if this sink is connected to a source pipe.

Definition at line 117 of file MIDI_Pipes.hpp.

◆ getSourcePipe()

MIDI_Pipe * getSourcePipe ( )
inline

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.

◆ stallDownstream()

virtual void stallDownstream ( MIDIStaller ,
MIDI_Source  
)
inlineprivatevirtual

Base case for recursive stall function.

See also
MIDI_Pipe::stallDownstream

Reimplemented in MIDI_Pipe.

Definition at line 127 of file MIDI_Pipes.hpp.

◆ unstallDownstream()

virtual void unstallDownstream ( MIDIStaller ,
MIDI_Source  
)
inlineprivatevirtual

Base case for recursive un-stall function.

See also
MIDI_Pipe::unstallDownstream

Reimplemented in MIDI_Pipe.

Definition at line 130 of file MIDI_Pipes.hpp.

◆ getFinalSink()

virtual MIDI_Sink * getFinalSink ( )
inlineprivatevirtual

Base case for recursive function.

See also
MIDI_Pipe::getFinalSink

Reimplemented in MIDI_Pipe.

Definition at line 133 of file MIDI_Pipes.hpp.

◆ disconnectSourcePipesShallow()

void disconnectSourcePipesShallow ( )
private

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.

◆ swap()

void swap ( MIDI_Sink a,
MIDI_Sink b 
)
static

Definition at line 56 of file MIDI_Pipes.cpp.

Member Data Documentation

◆ sourcePipe

MIDI_Pipe* sourcePipe = nullptr
protected

Definition at line 142 of file MIDI_Pipes.hpp.


The documentation for this class was generated from the following files: