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

#include <MIDI_Interfaces/DebugMIDI_Interface.hpp>

Detailed Description

A class for MIDI outputs sending human-readable MIDI messages over a Stream.

Definition at line 40 of file DebugMIDI_Interface.hpp.

+ Inheritance diagram for StreamDebugMIDI_Output:
+ Collaboration diagram for StreamDebugMIDI_Output:

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.
 

Public Member Functions

 StreamDebugMIDI_Output (Print &stream, const char *prefix=nullptr)
 
Print & getStream () const
 
void setPrefix (const char *prefix)
 Set the prefix to be printed before each message.
 
const chargetPrefix () const
 

Static Public Member Functions

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

Protected Member Functions

void sendChannelMessageImpl (ChannelMessage)
 
void sendSysCommonImpl (SysCommonMessage)
 
void sendSysExImpl (SysExMessage)
 
void sendRealTimeImpl (RealTimeMessage)
 
void sendNowImpl ()
 
void sinkMIDIfromPipe (ChannelMessage m) override
 Accept an incoming MIDI Channel message.
 
void sinkMIDIfromPipe (SysExMessage m) override
 Accept an incoming MIDI System Exclusive message.
 
void sinkMIDIfromPipe (SysCommonMessage m) override
 Accept an incoming MIDI System Common message.
 
void sinkMIDIfromPipe (RealTimeMessage m) override
 Accept an incoming MIDI Real-Time message.
 
void sendChannelMessageImpl (Print &, ChannelMessage)
 
void sendSysCommonImpl (Print &, SysCommonMessage)
 
void sendSysExImpl (Print &, SysExMessage)
 
void sendRealTimeImpl (Print &, RealTimeMessage)
 
void sendNowImpl (Print &)
 

Protected Attributes

Print & stream
 
friend MIDI_Sender< StreamDebugMIDI_Output >
 
MIDI_PipesourcePipe = nullptr
 

Private Member Functions

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.
 

Private Attributes

const charprefix = nullptr
 

Constructor & Destructor Documentation

◆ StreamDebugMIDI_Output()

StreamDebugMIDI_Output ( Print & stream,
const char * prefix = nullptr )
inline

Definition at line 44 of file DebugMIDI_Interface.hpp.

Member Function Documentation

◆ getStream()

Print & getStream ( ) const
inline

Definition at line 47 of file DebugMIDI_Interface.hpp.

◆ sendChannelMessageImpl() [1/2]

void sendChannelMessageImpl ( ChannelMessage m)
protected

Definition at line 125 of file DebugMIDI_Interface.cpp.

◆ sendSysCommonImpl() [1/2]

void sendSysCommonImpl ( SysCommonMessage m)
protected

Definition at line 128 of file DebugMIDI_Interface.cpp.

◆ sendSysExImpl() [1/2]

void sendSysExImpl ( SysExMessage m)
protected

Definition at line 131 of file DebugMIDI_Interface.cpp.

◆ sendRealTimeImpl() [1/2]

void sendRealTimeImpl ( RealTimeMessage m)
protected

Definition at line 134 of file DebugMIDI_Interface.cpp.

◆ sendNowImpl() [1/2]

void sendNowImpl ( )
protected

Definition at line 137 of file DebugMIDI_Interface.cpp.

◆ sinkMIDIfromPipe() [1/4]

void sinkMIDIfromPipe ( ChannelMessage )
inlineoverrideprotectedvirtual

Accept an incoming MIDI Channel message.

Implements MIDI_Sink.

Definition at line 57 of file DebugMIDI_Interface.hpp.

◆ sinkMIDIfromPipe() [2/4]

void sinkMIDIfromPipe ( SysExMessage )
inlineoverrideprotectedvirtual

Accept an incoming MIDI System Exclusive message.

Implements MIDI_Sink.

Definition at line 58 of file DebugMIDI_Interface.hpp.

◆ sinkMIDIfromPipe() [3/4]

void sinkMIDIfromPipe ( SysCommonMessage )
inlineoverrideprotectedvirtual

Accept an incoming MIDI System Common message.

Implements MIDI_Sink.

Definition at line 59 of file DebugMIDI_Interface.hpp.

◆ sinkMIDIfromPipe() [4/4]

void sinkMIDIfromPipe ( RealTimeMessage )
inlineoverrideprotectedvirtual

Accept an incoming MIDI Real-Time message.

Implements MIDI_Sink.

Definition at line 60 of file DebugMIDI_Interface.hpp.

◆ sendChannelMessageImpl() [2/2]

void sendChannelMessageImpl ( Print & stream,
ChannelMessage msg )
protectedinherited

Definition at line 52 of file DebugMIDI_Interface.cpp.

◆ sendSysCommonImpl() [2/2]

void sendSysCommonImpl ( Print & stream,
SysCommonMessage msg )
protectedinherited

Definition at line 93 of file DebugMIDI_Interface.cpp.

◆ sendSysExImpl() [2/2]

void sendSysExImpl ( Print & stream,
SysExMessage msg )
protectedinherited

Definition at line 79 of file DebugMIDI_Interface.cpp.

◆ sendRealTimeImpl() [2/2]

void sendRealTimeImpl ( Print & stream,
RealTimeMessage msg )
protectedinherited

Definition at line 113 of file DebugMIDI_Interface.cpp.

◆ sendNowImpl() [2/2]

void sendNowImpl ( Print & )
inlineprotectedinherited

Definition at line 21 of file DebugMIDI_Interface.hpp.

◆ setPrefix()

void setPrefix ( const char * prefix)
inlineinherited

Set the prefix to be printed before each message.

Definition at line 27 of file DebugMIDI_Interface.hpp.

◆ getPrefix()

const char * getPrefix ( ) const
inlineinherited

Definition at line 28 of file DebugMIDI_Interface.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

Send a MIDI Note On event.

◆ sendNoteOff()

void sendNoteOff ( MIDIAddress address,
uint8_t velocity )
inherited

Send a MIDI Note Off event.

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

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

◆ disconnect() [2/2]

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()

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

Definition at line 57 of file MIDI_Pipes.cpp.

Member Data Documentation

◆ stream

Print& stream
protected

Definition at line 63 of file DebugMIDI_Interface.hpp.

◆ MIDI_Sender< StreamDebugMIDI_Output >

Definition at line 65 of file DebugMIDI_Interface.hpp.

◆ prefix

const char* prefix = nullptr
privateinherited

Definition at line 31 of file DebugMIDI_Interface.hpp.

◆ sourcePipe

MIDI_Pipe* sourcePipe = nullptr
protectedinherited

Definition at line 146 of file MIDI_Pipes.hpp.


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