Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Control_Surface_ Class Reference

#include <Control_Surface/Control_Surface_Class.hpp>

Detailed Description

This class ensures initialization, updating, and interaction between all other classes, it's the glue that holds everything together.

Definition at line 26 of file Control_Surface_Class.hpp.

+ Inheritance diagram for Control_Surface_:
+ Collaboration diagram for Control_Surface_:

MIDI Input Callbacks

using ChannelMessageCallback = bool (*)(ChannelMessage)
 Callback function type for channel messages.
 
using SysExMessageCallback = bool (*)(SysExMessage)
 Callback function type for SysEx messages.
 
using SysCommonMessageCallback = bool (*)(SysCommonMessage)
 Callback function type for System Common messages.
 
using RealTimeMessageCallback = bool (*)(RealTimeMessage)
 Callback function type for Real-Time messages.
 
void setMIDIInputCallbacks (ChannelMessageCallback channelMessageCallback, SysExMessageCallback sysExMessageCallback, SysCommonMessageCallback sysCommonMessageCallback, RealTimeMessageCallback realTimeMessageCallback)
 Set the MIDI input callbacks.
 

Singleton boilerplate

 Control_Surface_ (Control_Surface_ const &)=delete
 Copying is not allowed.
 
Control_Surface_operator= (Control_Surface_ const &)=delete
 Copying is not allowed.
 
static Control_Surface_getInstance ()
 Return the static Control_Surface_ instance (Control_Surface_ is a singleton.)
 
 Control_Surface_ ()=default
 Control_Surface_ is a singleton, so the constructor is private.
 

Sending MIDI Channel Voice messages

void send (ChannelMessage message)
 Send a MIDI Channel Voice message.
 
void sendChannelMessage (MIDIMessageType m, Channel c, uint8_t d1, uint8_t d2, Cable cable=Cable_1)
 Send a 3-byte MIDI Channel Voice message.
 
void sendChannelMessage (MIDIMessageType m, Channel c, uint8_t d1, Cable cable=Cable_1)
 Send a 2-byte MIDI Channel Voice message.
 
void sendNoteOn (MIDIAddress address, uint8_t velocity)
 Send a MIDI Note On event.
 
void sendNoteOff (MIDIAddress address, uint8_t velocity)
 Send a MIDI Note Off event.
 
void sendKeyPressure (MIDIAddress address, uint8_t pressure)
 Send a MIDI Key Pressure event.
 
void sendControlChange (MIDIAddress address, uint8_t value)
 Send a MIDI Control Change event.
 
void sendProgramChange (MIDIAddress address)
 Send a MIDI Program Change event.
 
void sendProgramChange (MIDIChannelCable address, uint8_t value)
 Send a MIDI Program Change event.
 
void sendChannelPressure (MIDIChannelCable address, uint8_t pressure)
 Send a MIDI Channel Pressure event.
 
void sendPitchBend (MIDIChannelCable address, uint16_t value)
 Send a MIDI Pitch Bend event.
 

Sending MIDI System Common messages

void send (SysCommonMessage message)
 Send a MIDI System Common message.
 
void sendSysCommon (MIDIMessageType m, Cable cable=Cable_1)
 Send a MIDI System Common message.
 
void sendSysCommon (MIDIMessageType m, uint8_t data1, Cable cable=Cable_1)
 Send a MIDI System Common message.
 
void sendSysCommon (MIDIMessageType m, uint8_t data1, uint8_t data2, Cable cable=Cable_1)
 Send a MIDI System Common message.
 
void sendMTCQuarterFrame (uint8_t data, Cable cable=Cable_1)
 Send a MIDI Time Code Quarter Frame.
 
void sendMTCQuarterFrame (uint8_t messageType, uint8_t values, Cable cable=Cable_1)
 Send a MIDI Time Code Quarter Frame.
 
void sendSongPositionPointer (uint16_t spp, Cable cable=Cable_1)
 Send a MIDI Song Position Pointer message.
 
void sendSongSelect (uint8_t song, Cable cable=Cable_1)
 Send a MIDI Song Select message.
 
void sendTuneRequest (Cable cable=Cable_1)
 Send a MIDI Tune Request.
 

Sending MIDI System Exclusive messages

void send (SysExMessage message)
 Send a MIDI System Exclusive message.
 
void sendSysEx (const uint8_t(&sysexdata)[N], Cable cable=Cable_1)
 Send a MIDI System Exclusive message.
 
void sendSysEx (const uint8_t *data, uint16_t length, Cable cable=Cable_1)
 Send a MIDI System Exclusive message.
 

Sending MIDI Real-Time messages

void send (RealTimeMessage message)
 Send a MIDI Real-Time message.
 
void sendRealTime (MIDIMessageType rt, Cable cable=Cable_1)
 Send a MIDI Real-Time message.
 
void sendRealTime (uint8_t rt, Cable cable=Cable_1)
 Send a MIDI Real-Time message.
 
void sendTimingClock (Cable cable=Cable_1)
 Send a MIDI Timing Clock message.
 
void sendStart (Cable cable=Cable_1)
 Send a MIDI Start message.
 
void sendContinue (Cable cable=Cable_1)
 Send a MIDI Continue message.
 
void sendStop (Cable cable=Cable_1)
 Send a MIDI Stop message.
 
void sendActiveSensing (Cable cable=Cable_1)
 Send a MIDI Active Sensing message.
 
void sendSystemReset (Cable cable=Cable_1)
 Send a MIDI System Reset message.
 

Flushing the MIDI send buffer

void sendNow ()
 Causes all buffered messages to be sent immediately.
 

Deprecated

void sendKP (MIDIAddress address, uint8_t pressure)
 Send a MIDI Key Pressure event.
 
void sendCC (MIDIAddress address, uint8_t value)
 Send a MIDI Control Change event.
 
void sendPC (MIDIAddress address)
 Send a MIDI Program Change event.
 
void sendPC (MIDIChannelCable address, uint8_t value)
 Send a MIDI Program Change event.
 
void sendCP (MIDIChannelCable address, uint8_t pressure)
 Send a MIDI Channel Pressure event.
 
void sendPB (MIDIChannelCable address, uint16_t value)
 Send a MIDI Pitch Bend event.
 

Connecting and disconnecting MIDI Pipes

void connectSourcePipe (MIDI_Pipe *source)
 Fully connect a source pipe to this sink.
 
void disconnectSourcePipes ()
 Disconnect all source pipes that sink to this sink (recursively).
 
bool disconnect (TrueMIDI_Source &source)
 Disconnect the given source from this sink.
 
bool disconnect (MIDI_Pipe &)=delete
 
bool hasSourcePipe () const
 Check if this sink is connected to a source pipe.
 
MIDI_PipegetSourcePipe () const
 Get a pointer to the pipe this sink is connected to, or nullptr if not connected.
 

Connecting and disconnecting MIDI Pipes

bool disconnect (TrueMIDI_Sink &sink)
 Disconnect the given sink from this source.
 
bool disconnect (MIDI_Pipe &)=delete
 
void connectSinkPipe (MIDI_Pipe *sink)
 Fully connect a sink pipe to this source.
 
void disconnectSinkPipes ()
 Disconnect all sink pipes that this source sinks to (recursively).
 
bool hasSinkPipe () const
 Check if this source is connected to a sink pipe.
 
MIDI_PipegetSinkPipe ()
 Get a pointer to the pipe this source is connected to, or nullptr if not connected.
 

Sending data over a MIDI Pipe

void sourceMIDItoPipe (ChannelMessage)
 Send a MIDI Channel Message down the pipe.
 
void sourceMIDItoPipe (SysExMessage)
 Send a MIDI System Exclusive message down the pipe.
 
void sourceMIDItoPipe (SysCommonMessage)
 Send a MIDI System Common message down the pipe.
 
void sourceMIDItoPipe (RealTimeMessage)
 Send a MIDI Real-Time message down the pipe.
 

Stalling the sink pipes and exclusive access

void stall (MIDIStaller *cause=eternal_stall)
 Stall this MIDI source.
 
void unstall (MIDIStaller *cause=eternal_stall)
 Un-stall the pipes connected to this source, so other sources are allowed to send again.
 
bool isStalled () const
 Check if this source can write to the sinks it connects to.
 
MIDIStallergetStaller () const
 Get a pointer to whatever is causing this MIDI source to be stalled.
 
const char * getStallerName () const
 Get the name of whatever is causing this MIDI source to be stalled.
 
void handleStallers () const
 Give the code that is stalling the MIDI sink pipes the opportunity to do its job and un-stall the pipes.
 

Public Member Functions

void begin ()
 Initialize the Control_Surface.
 
void loop ()
 Update all MIDI elements, send MIDI events and read MIDI input.
 
bool connectDefaultMIDI_Interface ()
 Connect Control Surface to the default MIDI interface.
 
void disconnectMIDI_Interfaces ()
 Disconnect Control Surface from the MIDI interfaces it's connected to.
 
void updateMidiInput ()
 Update all MIDI interfaces to receive new MIDI events.
 
void updateInputs ()
 Update all MIDIInputElements.
 
void beginDisplays ()
 Initialize all displays that have at least one display element.
 
void updateDisplays ()
 Clear, draw and display all displays that contain display elements that have changed.
 

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

void sendChannelMessageImpl (ChannelMessage)
 Low-level function for sending a MIDI channel voice message.
 
void sendSysCommonImpl (SysCommonMessage)
 Low-level function for sending a MIDI system common message.
 
void sendSysExImpl (SysExMessage)
 Low-level function for sending a system exclusive MIDI message.
 
void sendRealTimeImpl (RealTimeMessage)
 Low-level function for sending a MIDI real-time message.
 
void sendNowImpl ()
 Low-level function for sending any buffered outgoing MIDI messages.
 
void sinkMIDIfromPipe (ChannelMessage msg) override
 Accept an incoming MIDI Channel message.
 
void sinkMIDIfromPipe (SysExMessage msg) override
 Accept an incoming MIDI System Exclusive message.
 
void sinkMIDIfromPipe (SysCommonMessage msg) override
 Accept an incoming MIDI System Common message.
 
void sinkMIDIfromPipe (RealTimeMessage msg) override
 Accept an incoming MIDI Real-Time message.
 
virtual void stallDownstream (MIDIStaller *, MIDI_Source *)
 Base case for recursive stall function.
 
virtual void unstallDownstream (MIDIStaller *, MIDI_Source *)
 Base case for recursive un-stall function.
 
virtual MIDI_SinkgetFinalSink ()
 Base case for recursive function.
 
void disconnectSourcePipesShallow ()
 Disconnect only the first pipe connected to this sink.
 
virtual void stallUpstream (MIDIStaller *, MIDI_Sink *)
 Base case for recursive stall function.
 
virtual void unstallUpstream (MIDIStaller *, MIDI_Sink *)
 Base case for recursive un-stall function.
 
virtual MIDI_SourcegetInitialSource ()
 Base case for recursive function.
 
void disconnectSinkPipesShallow ()
 Disconnect only the first pipe connected to this source.
 

Private Attributes

Timer< micros > displayTimer = {1000000UL / MAX_FPS}
 A timer to know when to refresh the displays.
 
ChannelMessageCallback channelMessageCallback = nullptr
 
SysExMessageCallback sysExMessageCallback = nullptr
 
SysCommonMessageCallback sysCommonMessageCallback = nullptr
 
RealTimeMessageCallback realTimeMessageCallback = nullptr
 
MIDI_Pipe inpipe
 
MIDI_Pipe outpipe
 

Member Typedef Documentation

◆ ChannelMessageCallback

Callback function type for channel messages.

Return true if handling is done in the user-provided callback, false if Control_Surface should handle the message.

Definition at line 113 of file Control_Surface_Class.hpp.

◆ SysExMessageCallback

Callback function type for SysEx messages.

Return true if handling is done in the user-provided callback, false if Control_Surface should handle the message.

Definition at line 117 of file Control_Surface_Class.hpp.

◆ SysCommonMessageCallback

Callback function type for System Common messages.

Return true if handling is done in the user-provided callback, false if Control_Surface should handle the message.

Definition at line 121 of file Control_Surface_Class.hpp.

◆ RealTimeMessageCallback

Callback function type for Real-Time messages.

Return true if handling is done in the user-provided callback, false if Control_Surface should handle the message.

Definition at line 125 of file Control_Surface_Class.hpp.

Constructor & Destructor Documentation

◆ Control_Surface_() [1/2]

Control_Surface_ ( Control_Surface_ const & )
delete

Copying is not allowed.

◆ Control_Surface_() [2/2]

Control_Surface_ ( )
privatedefault

Control_Surface_ is a singleton, so the constructor is private.

Member Function Documentation

◆ operator=()

Control_Surface_ & operator= ( Control_Surface_ const & )
delete

Copying is not allowed.

◆ getInstance()

Control_Surface_ & getInstance ( )
static

Return the static Control_Surface_ instance (Control_Surface_ is a singleton.)

Definition at line 17 of file Control_Surface_Class.cpp.

◆ begin()

void begin ( )

Initialize the Control_Surface.

See also
Purpose of the Control_Surface singleton
Examples
1.First-Output.ino, 1.Note-LED.ino, 10.Note-FastLED-ColorMapper.ino, 2.First-Input.ino, 2.Note-Range-LEDs.ino, 3.NoteLEDBar.ino, 4.VULEDs.ino, 5.Note-LED-PWM.ino, 6.MAX7219-NoteLED.ino, 9.Note-FastLED.ino, AbsoluteRotaryEncoder.ino, AppleMIDI.ino, Bank-Button-Matrix.ino, Bank.ino, Bankable-Smart-Control-Change-Potentiometer.ino, CCButton.ino, CCIncrementDecrementButtons.ino, CCPotentiometer-Map.ino, Control-Change-Potentiometer.ino, Custom-MIDI-Input-Element.ino, Custom-MIDI-Output-Element-Bankable.ino, Custom-MIDI-Output-Element.ino, Custom-MIDI-Sender.ino, Custom-Note-LED-Input-Element-Callback-FastLED.ino, Custom-Note-LED-Input-Element-Callback.ino, Custom-Selector-Callback.ino, Custom-USB-MIDI-Backend.ino, Debug-MIDI-Interface.ino, Dual-MIDI-Interface.ino, Encoder-Selector-Bank.ino, MCP23017-RotaryEncoder-Interrupts.ino, MCP23017-RotaryEncoder-No-Interrupts.ino, MCU-OLED-SSD1306-x2.ino, MCU-OLED-SSD1306.ino, MIDI-Controller-Finished-Example.ino, MIDI-Input-Callback.ino, MIDI-Monitor-OLED.ino, MIDI_controller-97.ino, Mackie-Control-Universal-Reverse-Engineering.ino, ManyAddressesPCButton.ino, Multiple-Control-Change-Potentiometers.ino, Note-ManyAddresses-Transposer.ino, NoteButton.ino, NoteButtonMatrix.ino, One-Pot-Both-PB-and-CC.ino, PCButton.ino, Pitch-Bend-Potentiometer.ino, Pitch-Bend-Value.ino, Program-Changer.ino, RotaryEncoder.ino, Serial-Interface.ino, Transpose-Octave-NC-Button.ino, Transposer.ino, and VU-Meter-Bridge.ino.

Definition at line 22 of file Control_Surface_Class.cpp.

◆ loop()

void loop ( )

Update all MIDI elements, send MIDI events and read MIDI input.

See also
Purpose of the Control_Surface singleton
Examples
1.First-Output.ino, 1.Note-LED.ino, 10.Note-FastLED-ColorMapper.ino, 2.First-Input.ino, 2.Note-Range-LEDs.ino, 3.NoteLEDBar.ino, 4.VULEDs.ino, 5.Note-LED-PWM.ino, 6.MAX7219-NoteLED.ino, 9.Note-FastLED.ino, AbsoluteRotaryEncoder.ino, AppleMIDI.ino, Bank-Button-Matrix.ino, Bank.ino, Bankable-Smart-Control-Change-Potentiometer.ino, CCButton.ino, CCIncrementDecrementButtons.ino, CCPotentiometer-Map.ino, Control-Change-Potentiometer.ino, Custom-MIDI-Input-Element.ino, Custom-MIDI-Output-Element-Bankable.ino, Custom-MIDI-Output-Element.ino, Custom-MIDI-Sender.ino, Custom-Note-LED-Input-Element-Callback-FastLED.ino, Custom-Note-LED-Input-Element-Callback.ino, Custom-Selector-Callback.ino, Custom-USB-MIDI-Backend.ino, Debug-MIDI-Interface.ino, Dual-MIDI-Interface.ino, Encoder-Selector-Bank.ino, MCP23017-RotaryEncoder-Interrupts.ino, MCP23017-RotaryEncoder-No-Interrupts.ino, MCU-OLED-SSD1306-x2.ino, MCU-OLED-SSD1306.ino, MIDI-Controller-Finished-Example.ino, MIDI-Input-Callback.ino, MIDI-Monitor-OLED.ino, MIDI_controller-97.ino, Mackie-Control-Universal-Reverse-Engineering.ino, ManyAddressesPCButton.ino, Multiple-Control-Change-Potentiometers.ino, Note-ManyAddresses-Transposer.ino, NoteButton.ino, NoteButtonMatrix.ino, One-Pot-Both-PB-and-CC.ino, PCButton.ino, Pitch-Bend-Potentiometer.ino, Pitch-Bend-Value.ino, Program-Changer.ino, RotaryEncoder.ino, Serial-Interface.ino, Transpose-Octave-NC-Button.ino, Transposer.ino, and VU-Meter-Bridge.ino.

Definition at line 71 of file Control_Surface_Class.cpp.

◆ connectDefaultMIDI_Interface()

bool connectDefaultMIDI_Interface ( )

Connect Control Surface to the default MIDI interface.

Definition at line 47 of file Control_Surface_Class.cpp.

◆ disconnectMIDI_Interfaces()

void disconnectMIDI_Interfaces ( )

Disconnect Control Surface from the MIDI interfaces it's connected to.

Definition at line 64 of file Control_Surface_Class.cpp.

◆ updateMidiInput()

void updateMidiInput ( )

Update all MIDI interfaces to receive new MIDI events.

Definition at line 81 of file Control_Surface_Class.cpp.

◆ updateInputs()

void updateInputs ( )

Update all MIDIInputElements.

Definition at line 271 of file Control_Surface_Class.cpp.

◆ beginDisplays()

void beginDisplays ( )

Initialize all displays that have at least one display element.

Definition at line 281 of file Control_Surface_Class.cpp.

◆ updateDisplays()

void updateDisplays ( )

Clear, draw and display all displays that contain display elements that have changed.

Examples
2.VU-Meter-OLED-USB-DAC.ino.

Definition at line 302 of file Control_Surface_Class.cpp.

◆ sendChannelMessageImpl()

void sendChannelMessageImpl ( ChannelMessage msg)
private

Low-level function for sending a MIDI channel voice message.

Definition at line 113 of file Control_Surface_Class.cpp.

◆ sendSysCommonImpl()

void sendSysCommonImpl ( SysCommonMessage msg)
private

Low-level function for sending a MIDI system common message.

Definition at line 119 of file Control_Surface_Class.cpp.

◆ sendSysExImpl()

void sendSysExImpl ( SysExMessage msg)
private

Low-level function for sending a system exclusive MIDI message.

Definition at line 116 of file Control_Surface_Class.cpp.

◆ sendRealTimeImpl()

void sendRealTimeImpl ( RealTimeMessage msg)
private

Low-level function for sending a MIDI real-time message.

Definition at line 122 of file Control_Surface_Class.cpp.

◆ sendNowImpl()

void sendNowImpl ( )
inlineprivate

Low-level function for sending any buffered outgoing MIDI messages.

Definition at line 86 of file Control_Surface_Class.hpp.

◆ sinkMIDIfromPipe() [1/4]

void sinkMIDIfromPipe ( ChannelMessage )
overrideprivatevirtual

Accept an incoming MIDI Channel message.

Implements MIDI_Sink.

Definition at line 144 of file Control_Surface_Class.cpp.

◆ sinkMIDIfromPipe() [2/4]

void sinkMIDIfromPipe ( SysExMessage )
overrideprivatevirtual

Accept an incoming MIDI System Exclusive message.

Implements MIDI_Sink.

Definition at line 231 of file Control_Surface_Class.cpp.

◆ sinkMIDIfromPipe() [3/4]

void sinkMIDIfromPipe ( SysCommonMessage )
overrideprivatevirtual

Accept an incoming MIDI System Common message.

Implements MIDI_Sink.

Definition at line 247 of file Control_Surface_Class.cpp.

◆ sinkMIDIfromPipe() [4/4]

void sinkMIDIfromPipe ( RealTimeMessage )
overrideprivatevirtual

Accept an incoming MIDI Real-Time message.

Implements MIDI_Sink.

Definition at line 259 of file Control_Surface_Class.cpp.

◆ setMIDIInputCallbacks()

void setMIDIInputCallbacks ( ChannelMessageCallback channelMessageCallback,
SysExMessageCallback sysExMessageCallback,
SysCommonMessageCallback sysCommonMessageCallback,
RealTimeMessageCallback realTimeMessageCallback )
inline

Set the MIDI input callbacks.

Examples
MIDI-Input-Callback.ino, and Mackie-Control-Universal-Reverse-Engineering.ino.

Definition at line 129 of file Control_Surface_Class.hpp.

◆ send() [1/4]

void send ( ChannelMessage message)
inherited

Send a MIDI Channel Voice message.

◆ send() [2/4]

void send ( SysCommonMessage message)
inherited

Send a MIDI System Common message.

◆ send() [3/4]

void send ( SysExMessage message)
inherited

Send a MIDI System Exclusive message.

◆ send() [4/4]

void send ( RealTimeMessage message)
inherited

Send a MIDI Real-Time message.

◆ sendChannelMessage() [1/2]

void sendChannelMessage ( MIDIMessageType m,
Channel c,
uint8_t d1,
uint8_t d2,
Cable cable = Cable_1 )
inherited

Send a 3-byte MIDI Channel Voice message.

Parameters
mMIDI message type. [0x80, 0xE0]
cThe MIDI channel. [1, 16]
d1The first data byte. [0, 127]
d2The second data byte. [0, 127]
cableThe MIDI Cable Number. [Cable_1, Cable_16]

◆ sendChannelMessage() [2/2]

void sendChannelMessage ( MIDIMessageType m,
Channel c,
uint8_t d1,
Cable cable = Cable_1 )
inherited

Send a 2-byte MIDI Channel Voice message.

Parameters
mMIDI message type. [0x80, 0xE0]
cThe MIDI channel. [1, 16]
d1The first data byte. [0, 127]
cableThe MIDI Cable Number. [1, 16]

◆ sendNoteOn()

void sendNoteOn ( MIDIAddress address,
uint8_t velocity )
inherited

◆ sendNoteOff()

void sendNoteOff ( MIDIAddress address,
uint8_t velocity )
inherited

◆ sendKeyPressure()

void sendKeyPressure ( MIDIAddress address,
uint8_t pressure )
inherited

Send a MIDI Key Pressure event.

◆ sendControlChange()

void sendControlChange ( MIDIAddress address,
uint8_t value )
inherited

Send a MIDI Control Change event.

◆ sendProgramChange() [1/2]

void sendProgramChange ( MIDIAddress address)
inherited

Send a MIDI Program Change event.

◆ sendProgramChange() [2/2]

void sendProgramChange ( MIDIChannelCable address,
uint8_t value )
inherited

Send a MIDI Program Change event.

◆ sendChannelPressure()

void sendChannelPressure ( MIDIChannelCable address,
uint8_t pressure )
inherited

Send a MIDI Channel Pressure event.

◆ sendPitchBend()

void sendPitchBend ( MIDIChannelCable address,
uint16_t value )
inherited

Send a MIDI Pitch Bend event.

◆ sendSysCommon() [1/3]

void sendSysCommon ( MIDIMessageType m,
Cable cable = Cable_1 )
inherited

Send a MIDI System Common message.

◆ sendSysCommon() [2/3]

void sendSysCommon ( MIDIMessageType m,
uint8_t data1,
Cable cable = Cable_1 )
inherited

Send a MIDI System Common message.

◆ sendSysCommon() [3/3]

void sendSysCommon ( MIDIMessageType m,
uint8_t data1,
uint8_t data2,
Cable cable = Cable_1 )
inherited

Send a MIDI System Common message.

◆ sendMTCQuarterFrame() [1/2]

void sendMTCQuarterFrame ( uint8_t data,
Cable cable = Cable_1 )
inherited

Send a MIDI Time Code Quarter Frame.

◆ sendMTCQuarterFrame() [2/2]

void sendMTCQuarterFrame ( uint8_t messageType,
uint8_t values,
Cable cable = Cable_1 )
inherited

Send a MIDI Time Code Quarter Frame.

◆ sendSongPositionPointer()

void sendSongPositionPointer ( uint16_t spp,
Cable cable = Cable_1 )
inherited

Send a MIDI Song Position Pointer message.

◆ sendSongSelect()

void sendSongSelect ( uint8_t song,
Cable cable = Cable_1 )
inherited

Send a MIDI Song Select message.

◆ sendTuneRequest()

void sendTuneRequest ( Cable cable = Cable_1)
inherited

Send a MIDI Tune Request.

◆ sendSysEx() [1/2]

void sendSysEx ( const uint8_t(&) sysexdata[N],
Cable cable = Cable_1 )
inherited

Send a MIDI System Exclusive message.

◆ sendSysEx() [2/2]

void sendSysEx ( const uint8_t * data,
uint16_t length,
Cable cable = Cable_1 )
inherited

Send a MIDI System Exclusive message.

◆ sendRealTime() [1/2]

void sendRealTime ( MIDIMessageType rt,
Cable cable = Cable_1 )
inherited

Send a MIDI Real-Time message.

Examples
Custom-USB-MIDI-Backend.ino.

◆ sendRealTime() [2/2]

void sendRealTime ( uint8_t rt,
Cable cable = Cable_1 )
inherited

Send a MIDI Real-Time message.

◆ sendTimingClock()

void sendTimingClock ( Cable cable = Cable_1)
inherited

Send a MIDI Timing Clock message.

◆ sendStart()

void sendStart ( Cable cable = Cable_1)
inherited

Send a MIDI Start message.

◆ sendContinue()

void sendContinue ( Cable cable = Cable_1)
inherited

Send a MIDI Continue message.

◆ sendStop()

void sendStop ( Cable cable = Cable_1)
inherited

Send a MIDI Stop message.

◆ sendActiveSensing()

void sendActiveSensing ( Cable cable = Cable_1)
inherited

Send a MIDI Active Sensing message.

◆ sendSystemReset()

void sendSystemReset ( Cable cable = Cable_1)
inherited

Send a MIDI System Reset message.

◆ sendNow()

void sendNow ( )
inherited

Causes all buffered messages to be sent immediately.

Note
Doesn't necessarily wait until all data has been sent, it just triggers the transmission, so everything will be transmitted as soon as possible.

◆ sendKP()

void sendKP ( MIDIAddress address,
uint8_t pressure )
inherited

Send a MIDI Key Pressure event.

◆ sendCC()

void sendCC ( MIDIAddress address,
uint8_t value )
inherited

Send a MIDI Control Change event.

◆ sendPC() [1/2]

void sendPC ( MIDIAddress address)
inherited

Send a MIDI Program Change event.

◆ sendPC() [2/2]

void sendPC ( MIDIChannelCable address,
uint8_t value )
inherited

Send a MIDI Program Change event.

◆ sendCP()

void sendCP ( MIDIChannelCable address,
uint8_t pressure )
inherited

Send a MIDI Channel Pressure event.

◆ sendPB()

void sendPB ( MIDIChannelCable address,
uint16_t value )
inherited

Send a MIDI Pitch Bend event.

◆ connectSourcePipe()

void connectSourcePipe ( MIDI_Pipe * source)
inherited

Fully connect a source pipe to this sink.

Definition at line 17 of file MIDI_Pipes.cpp.

◆ disconnectSourcePipes()

void disconnectSourcePipes ( )
inherited

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

Definition at line 26 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 41 of file MIDI_Pipes.cpp.

◆ disconnect() [2/4]

bool disconnect ( MIDI_Pipe & )
deleteinherited

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

◆ disconnect() [4/4]

bool disconnect ( MIDI_Pipe & )
deleteinherited

◆ hasSourcePipe()

bool hasSourcePipe ( ) const
inlineinherited

Check if this sink is connected to a source pipe.

Definition at line 121 of file MIDI_Pipes.hpp.

◆ getSourcePipe()

MIDI_Pipe * getSourcePipe ( ) const
inlineinherited

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

Definition at line 124 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 131 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 134 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 137 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 34 of file MIDI_Pipes.cpp.

◆ swap() [1/2]

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

Definition at line 57 of file MIDI_Pipes.cpp.

◆ swap() [2/2]

void swap ( MIDI_Source & a,
MIDI_Source & b )
staticinherited

Definition at line 114 of file MIDI_Pipes.cpp.

◆ sourceMIDItoPipe() [1/4]

void sourceMIDItoPipe ( ChannelMessage msg)
inherited

Send a MIDI Channel Message down the pipe.

Definition at line 133 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 139 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 145 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 151 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 158 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 164 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 76 of file MIDI_Pipes.cpp.

◆ disconnectSinkPipes()

void disconnectSinkPipes ( )
inherited

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

Definition at line 85 of file MIDI_Pipes.cpp.

◆ hasSinkPipe()

bool hasSinkPipe ( ) const
inlineinherited

Check if this source is connected to a sink pipe.

Definition at line 237 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 240 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 247 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 250 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 253 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 93 of file MIDI_Pipes.cpp.

Member Data Documentation

◆ displayTimer

Timer<micros> displayTimer = {1000000UL / MAX_FPS}
private

A timer to know when to refresh the displays.

Definition at line 104 of file Control_Surface_Class.hpp.

◆ channelMessageCallback

ChannelMessageCallback channelMessageCallback = nullptr
private

Definition at line 142 of file Control_Surface_Class.hpp.

◆ sysExMessageCallback

SysExMessageCallback sysExMessageCallback = nullptr
private

Definition at line 143 of file Control_Surface_Class.hpp.

◆ sysCommonMessageCallback

SysCommonMessageCallback sysCommonMessageCallback = nullptr
private

Definition at line 144 of file Control_Surface_Class.hpp.

◆ realTimeMessageCallback

RealTimeMessageCallback realTimeMessageCallback = nullptr
private

Definition at line 145 of file Control_Surface_Class.hpp.

◆ inpipe

MIDI_Pipe inpipe
private

Definition at line 147 of file Control_Surface_Class.hpp.

◆ outpipe

MIDI_Pipe outpipe
private

Definition at line 147 of file Control_Surface_Class.hpp.

◆ sourcePipe

MIDI_Pipe* sourcePipe = nullptr
protectedinherited

Definition at line 146 of file MIDI_Pipes.hpp.

◆ sinkPipe

MIDI_Pipe* sinkPipe = nullptr
protectedinherited

Definition at line 262 of file MIDI_Pipes.hpp.


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