Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
MIDI_Interface.cpp
Go to the documentation of this file.
1#include "MIDI_Interface.hpp"
2#include "MIDI_Callbacks.hpp"
3
5
6// -------------------------------------------------------------------------- //
7
8// Managing the default MIDI interface
9
14
16
17#ifndef ARDUINO
18#define DOWN_CAST dynamic_cast
19#else
20#define DOWN_CAST static_cast
21#endif
22
28
30
31// -------------------------------------------------------------------------- //
32
33// Handling incoming MIDI events
34
36 sourceMIDItoPipe(message);
37 if (callbacks)
38 callbacks->onChannelMessage(*this, message);
39}
40
42 sourceMIDItoPipe(message);
43 if (callbacks)
44 callbacks->onSysExMessage(*this, message);
45}
46
49 if (callbacks)
50 callbacks->onSysCommonMessage(*this, message);
51}
52
54 sourceMIDItoPipe(message);
55 if (callbacks)
56 callbacks->onRealTimeMessage(*this, message);
57}
58
#define DOWN_CAST
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
static DoublyLinkedList< Updatable< NormalUpdatable > > updatables
An abstract class for MIDI interfaces.
void onSysCommonMessage(SysCommonMessage message)
Call the System Common message callback and send the message to the sink pipe.
MIDI_Interface()=default
virtual ~MIDI_Interface()
Destructor.
void setAsDefault()
Set this MIDI interface as the default interface.
MIDI_Callbacks * callbacks
void onSysExMessage(SysExMessage message)
Call the SysEx message callback and send the message to the sink pipe.
void onRealTimeMessage(RealTimeMessage message)
Call the real-time message callback and send the message to the sink pipe.
static MIDI_Interface * DefaultMIDI_Interface
void onChannelMessage(ChannelMessage message)
Call the channel message callback and send the message to the sink pipe.
static MIDI_Interface * getDefault()
Return the default MIDI interface.
void sourceMIDItoPipe(ChannelMessage)
Send a MIDI Channel Message down the pipe.