23#if defined(ARDUINO) && defined(DEBUG_OUT)
31 ExtendedIOElement::beginAll();
35 MIDIInputElementNote::beginAll();
36 MIDIInputElementKP::beginAll();
37 MIDIInputElementCC::beginAll();
38 MIDIInputElementPC::beginAll();
39 MIDIInputElementCP::beginAll();
40 MIDIInputElementPB::beginAll();
53 FATAL_ERROR(F(
"No default MIDI Interface"), 0xF123);
72 ExtendedIOElement::updateAllBufferedInputs();
78 ExtendedIOElement::updateAllBufferedOutputs();
106 event = iface->read();
145#ifdef DEBUG_MIDI_PACKETS
163 DEBUG(F(
"Reset All Controllers"));
164 MIDIInputElementCC::resetAll();
165 MIDIInputElementCP::resetAll();
169 MIDIInputElementNote::resetAll();
175 DEBUGFN(F(
"Updating Note elements with new MIDI "
177 MIDIInputElementNote::updateAllWith(midimsg);
180 DEBUGFN(F(
"Updating Key Pressure elements with new MIDI "
182 MIDIInputElementKP::updateAllWith(midimsg);
185 DEBUGFN(F(
"Updating CC elements with new MIDI "
187 MIDIInputElementCC::updateAllWith(midimsg);
190 DEBUGFN(F(
"Updating Program Change elements with new MIDI "
192 MIDIInputElementPC::updateAllWith(midimsg);
195 DEBUGFN(F(
"Updating Channel Pressure elements with new MIDI "
197 MIDIInputElementCP::updateAllWith(midimsg);
201 DEBUGFN(F(
"Updating Pitch Bend elements with new MIDI "
203 MIDIInputElementPB::updateAllWith(midimsg);
232#ifdef DEBUG_MIDI_PACKETS
236 for (
size_t i = 0;
i < len;
i++)
248#ifdef DEBUG_MIDI_PACKETS
249 DEBUG_OUT <<
">>> " << hex <<
msg.getMessageType() <<
' ' <<
msg.getData1()
250 <<
' ' <<
msg.getData2() <<
" (" <<
msg.cable <<
')' << dec
260#ifdef DEBUG_MIDI_PACKETS
262 <<
rtMessage.cable.getOneBased() <<
')' << dec);
272 MIDIInputElementNote::updateAll();
273 MIDIInputElementKP::updateAll();
274 MIDIInputElementCC::updateAll();
275 MIDIInputElementPC::updateAll();
276 MIDIInputElementCP::updateAll();
277 MIDIInputElementPB::updateAll();
313 dirty |=
it->getDirty();
337#if CS_TRUE_CONTROL_SURFACE_INSTANCE || defined(DOXYGEN)
#define DEBUG_OUT
The debug output.
Control_Surface_ & Control_Surface
A predefined instance of the Control Surface to use in the Arduino sketches.
MIDIReadEvent
Values returned by the MIDI reading functions.
@ CHANNEL_MESSAGE
A MIDI Channel message was received.
@ SYSEX_CHUNK
An incomplete System Exclusive message.
@ SYSCOMMON_MESSAGE
A MIDI System Common message was received.
@ NO_MESSAGE
No new messages were received.
@ SYSEX_MESSAGE
A MIDI System Exclusive message was received.
@ REALTIME_MESSAGE
A MIDI Real-Time message was received.
@ UndefinedSysCommon1
Undefined System Common message 0xF4 (1B).
@ Stop
Stop System Real-Time message.
@ KeyPressure
Key Pressure Channel Voice message (3B).
@ TimingClock
Timing Clock System Real-Time message.
@ UndefinedRealTime1
Undefined System Real-Time message 0xF9.
@ NoteOn
Note On Channel Voice message (3B).
@ UndefinedRealTime2
Undefined System Real-Time message 0xFD.
@ ActiveSensing
Active Sensing System Real-Time message.
@ SysExStart
Start of System Exclusive.
@ NoteOff
Note Off Channel Voice message (3B).
@ TuneRequest
Tune Request System Common message (1B).
@ None
Special value that does not correspond to an actual message type.
@ ControlChange
Control Change Channel Voice message (3B).
@ SystemReset
Reset System Real-Time message.
@ MTCQuarterFrame
MIDI Time Code Quarter Frame System Common message (2B).
@ Continue
Continue System Real-Time message.
@ Start
Start System Real-Time message.
@ SongSelect
Song Select System Common message (2B).
@ ChannelPressure
Channel Pressure Channel Voice message (2B).
@ UndefinedSysCommon2
Undefined System Common message 0xF5 (1B).
@ SysExEnd
End of System Exclusive.
@ PitchBend
Pitch Bend Channel Voice message (3B).
@ SongPositionPointer
Song Position Pointer System Common message (3B).
@ ProgramChange
Program Change Channel Voice message (2B).
#define BEGIN_CS_NAMESPACE
An abstract base class for Extended Input/Output elements.
A class that reads and filters an analog input.
void begin()
Initialize or reset the timer. The timer will fire immediately.
A super class for object that have to be updated regularly.
constexpr uint8_t getOneBased() const
Get the cable as an integer.
This class ensures initialization, updating, and interaction between all other classes,...
void updateDisplays()
Clear, draw and display all displays that contain display elements that have changed.
Timer< micros > displayTimer
A timer to know when to refresh the displays.
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 updateInputs()
Update all MIDIInputElements.
ChannelMessageCallback channelMessageCallback
static Control_Surface_ & getInstance()
Return the static Control_Surface_ instance (Control_Surface_ is a singleton.)
void updateMidiInput()
Update all MIDI interfaces to receive new MIDI events.
void sendSysExImpl(SysExMessage)
Low-level function for sending a system exclusive MIDI message.
void sinkMIDIfromPipe(ChannelMessage msg) override
Accept an incoming MIDI Channel message.
SysCommonMessageCallback sysCommonMessageCallback
void begin()
Initialize the Control_Surface.
RealTimeMessageCallback realTimeMessageCallback
void beginDisplays()
Initialize all displays that have at least one display element.
SysExMessageCallback sysExMessageCallback
void sendSysCommonImpl(SysCommonMessage)
Low-level function for sending a MIDI system common message.
void sendChannelMessageImpl(ChannelMessage)
Low-level function for sending a MIDI channel voice message.
void sendRealTimeImpl(RealTimeMessage)
Low-level function for sending a MIDI real-time message.
void loop()
Update all MIDI elements, send MIDI events and read MIDI input.
static DoublyLinkedList< DisplayElement > & getAll()
Get the list of all DisplayElement instances.
static void dispatchIncoming(MIDIInterface_t *iface, MIDIReadEvent event)
Dispatch the given type of MIDI message from the given interface.
static MIDI_Interface * getDefault()
Return the default MIDI interface.
void disconnectSourcePipes()
Disconnect all source pipes that sink to this sink (recursively).
bool hasSourcePipe() const
Check if this sink is connected to a source pipe.
void sourceMIDItoPipe(ChannelMessage)
Send a MIDI Channel Message down the pipe.
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.
#define DEBUG(x)
Print an expression to the debug output if debugging is enabled.
#define DEBUGFN(x)
Print an expression and its function (function name and line number) to the debug output if debugging...
#define FATAL_ERROR(msg, errc)
Print the error message and error code, and stop the execution.
constexpr unsigned long defaultBaudRate
The default baud rate for debug output.
constexpr uint8_t Reset_All_Controllers
constexpr uint8_t All_Notes_Off
An array wrapper for easy copying, comparing, and iterating.
static constexpr size_t length
T * begin()
Get a pointer to the first element.
T * end()
Get a pointer to the memory beyond the array.
MIDIMessageType getMessageType() const
Get the MIDI message type.
bool hasTwoDataBytes() const
Check whether this message has one or two data bytes.
uint8_t data2
First MIDI data byte.
uint8_t header
MIDI status byte (message type and channel).
uint8_t getData1() const
Get the first data byte.
uint8_t data1
First MIDI data byte.
Cable cable
USB MIDI cable number;.