Control Surface new-input
MIDI Control Surface library for Arduino
MIDI_Sender.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
10 template <class Derived>
11 class MIDI_Sender {
12  public:
15 
17  void send(ChannelMessage message);
18 
33  void sendChannelMessage(MIDIMessageType m, Channel c, uint8_t d1,
34  uint8_t d2, Cable cable = CABLE_1);
35 
48  void sendChannelMessage(MIDIMessageType m, Channel c, uint8_t d1,
49  Cable cable = CABLE_1);
50 
52  void sendNoteOn(MIDIAddress address, uint8_t velocity);
54  void sendNoteOff(MIDIAddress address, uint8_t velocity);
56  void sendKeyPressure(MIDIAddress address, uint8_t pressure);
58  void sendControlChange(MIDIAddress address, uint8_t value);
60  void sendProgramChange(MIDIAddress address);
62  void sendProgramChange(MIDIChannelCable address, uint8_t value);
64  void sendChannelPressure(MIDIChannelCable address, uint8_t pressure);
66  void sendPitchBend(MIDIChannelCable address, uint16_t value);
67 
69 
72 
74  void send(SysCommonMessage message);
76  void sendSysCommon(MIDIMessageType m, Cable cable = CABLE_1);
78  void sendSysCommon(MIDIMessageType m, uint8_t data1, Cable cable = CABLE_1);
80  void sendSysCommon(MIDIMessageType m, uint8_t data1, uint8_t data2,
81  Cable cable = CABLE_1);
82 
84  void sendMTCQuarterFrame(uint8_t data, Cable cable = CABLE_1);
86  void sendMTCQuarterFrame(uint8_t messageType, uint8_t values,
87  Cable cable = CABLE_1);
89  void sendSongPositionPointer(uint16_t spp, Cable cable = CABLE_1);
91  void sendSongSelect(uint8_t song, Cable cable = CABLE_1);
93  void sendTuneRequest(Cable cable = CABLE_1);
94 
96 
99 
101  void send(SysExMessage message);
103  template <uint16_t N>
104  void sendSysEx(const uint8_t (&sysexdata)[N], Cable cable = CABLE_1);
106  void sendSysEx(const uint8_t *data, uint16_t length, Cable cable = CABLE_1);
107 
109 
112 
114  void send(RealTimeMessage message);
116  void sendRealTime(MIDIMessageType rt, Cable cable = CABLE_1);
118  void sendRealTime(uint8_t rt, Cable cable = CABLE_1);
119 
121  void sendTimingClock(Cable cable = CABLE_1);
123  void sendStart(Cable cable = CABLE_1);
125  void sendContinue(Cable cable = CABLE_1);
127  void sendStop(Cable cable = CABLE_1);
129  void sendActiveSensing(Cable cable = CABLE_1);
131  void sendSystemReset(Cable cable = CABLE_1);
132 
134 
137 
142  void sendNow();
143 
145 
148 
151  [[deprecated("Use sendKeyPressure() instead")]] void
152  sendKP(MIDIAddress address, uint8_t pressure);
155  [[deprecated("Use sendControlChange() instead")]] void
156  sendCC(MIDIAddress address, uint8_t value);
159  [[deprecated("Use sendProgramChange() instead")]] void
160  sendPC(MIDIAddress address);
163  [[deprecated("Use sendProgramChange() instead")]] void
164  sendPC(MIDIChannelCable address, uint8_t value);
167  [[deprecated("Use sendChannelPressure() instead")]] void
168  sendCP(MIDIChannelCable address, uint8_t pressure);
171  [[deprecated("Use sendPitchBend() instead")]] void
172  sendPB(MIDIChannelCable address, uint16_t value);
173 
175 };
176 
178 
179 #include "MIDI_Sender.ipp"
constexpr Cable CABLE_1
Definition: Cable.hpp:118
MIDIMessageType
All possible MIDI status byte values (without channel).
#define END_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
A type-safe class for MIDI USB Cable numbers.
Definition: Cable.hpp:13
A type-safe class for MIDI channels.
Definition: Channel.hpp:13
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
A class for saving a MIDI channel and cable number.
Definition: MIDIAddress.hpp:24
Statically polymorphic template for classes that send MIDI messages.
Definition: MIDI_Sender.hpp:11
void sendNow()
Causes all buffered messages to be sent immediately.
void sendSysEx(const uint8_t(&sysexdata)[N], Cable cable=CABLE_1)
Send a MIDI System Exclusive message.
void sendChannelPressure(MIDIChannelCable address, uint8_t pressure)
Send a MIDI Channel Pressure event.
Definition: MIDI_Sender.ipp:89
void sendPB(MIDIChannelCable address, uint16_t value)
Send a MIDI Pitch Bend event.
void sendStart(Cable cable=CABLE_1)
Send a MIDI Start message.
void sendRealTime(MIDIMessageType rt, Cable cable=CABLE_1)
Send a MIDI Real-Time 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.
Definition: MIDI_Sender.ipp:7
void sendKP(MIDIAddress address, uint8_t pressure)
Send a MIDI Key Pressure event.
void sendMTCQuarterFrame(uint8_t data, Cable cable=CABLE_1)
Send a MIDI Time Code Quarter Frame.
void sendSysCommon(MIDIMessageType m, Cable cable=CABLE_1)
Send a MIDI System Common message.
void sendProgramChange(MIDIAddress address)
Send a MIDI Program Change event.
Definition: MIDI_Sender.ipp:78
void sendSystemReset(Cable cable=CABLE_1)
Send a MIDI System Reset message.
void send(ChannelMessage message)
Send a MIDI Channel Voice message.
void sendCP(MIDIChannelCable address, uint8_t pressure)
Send a MIDI Channel Pressure event.
void sendActiveSensing(Cable cable=CABLE_1)
Send a MIDI Active Sensing message.
void sendCC(MIDIAddress address, uint8_t value)
Send a MIDI Control Change event.
void sendStop(Cable cable=CABLE_1)
Send a MIDI Stop message.
void sendKeyPressure(MIDIAddress address, uint8_t pressure)
Send a MIDI Key Pressure event.
Definition: MIDI_Sender.ipp:42
void sendControlChange(MIDIAddress address, uint8_t value)
Send a MIDI Control Change event.
Definition: MIDI_Sender.ipp:54
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 sendPC(MIDIAddress address)
Send a MIDI Program Change event.
void sendNoteOn(MIDIAddress address, uint8_t velocity)
Send a MIDI Note On event.
Definition: MIDI_Sender.ipp:20
void sendNoteOff(MIDIAddress address, uint8_t velocity)
Send a MIDI Note Off event.
Definition: MIDI_Sender.ipp:31
void sendTuneRequest(Cable cable=CABLE_1)
Send a MIDI Tune Request.
void sendTimingClock(Cable cable=CABLE_1)
Send a MIDI Timing Clock message.
void sendPitchBend(MIDIChannelCable address, uint16_t value)
Send a MIDI Pitch Bend event.
void sendContinue(Cable cable=CABLE_1)
Send a MIDI Continue message.