6 template <
class Derived>
8 uint8_t d1, uint8_t d2,
13 template <
class Derived>
15 uint8_t d1,
Cable cable) {
19 template <
class Derived>
22 CRTP(Derived).sendChannelMessageImpl({
26 uint8_t(velocity & 0x7F),
30 template <
class Derived>
33 CRTP(Derived).sendChannelMessageImpl({
37 uint8_t(velocity & 0x7F),
41 template <
class Derived>
45 CRTP(Derived).sendChannelMessageImpl({
49 uint8_t(pressure & 0x7F),
53 template <
class Derived>
57 CRTP(Derived).sendChannelMessageImpl({
61 uint8_t(value & 0x7F),
65 template <
class Derived>
69 CRTP(Derived).sendChannelMessageImpl({
72 uint8_t(value & 0x7F),
77 template <
class Derived>
80 CRTP(Derived).sendChannelMessageImpl({
88 template <
class Derived>
92 CRTP(Derived).sendChannelMessageImpl({
95 uint8_t(pressure & 0x7F),
100 template <
class Derived>
104 CRTP(Derived).sendChannelMessageImpl({
107 uint8_t((value >> 0) & 0x7F),
108 uint8_t((value >> 7) & 0x7F),
112 template <
class Derived>
115 CRTP(Derived).sendSysExImpl(message);
118 template <
class Derived>
121 CRTP(Derived).sendRealTimeImpl(message);
124 template <
class Derived>
128 CRTP(Derived).sendChannelMessageImpl(message);
132 template <
class Derived>
136 CRTP(Derived).sendSysCommonImpl(message);
140 template <
class Derived>
141 template <u
int16_t N>
146 template <
class Derived>
152 template <
class Derived>
156 template <
class Derived>
161 template <
class Derived>
163 uint8_t data2,
Cable cable) {
167 template <
class Derived>
171 template <
class Derived>
173 uint8_t values,
Cable cable) {
174 sendMTCQuarterFrame((messageType << 4) | values, cable);
176 template <
class Derived>
182 template <
class Derived>
186 template <
class Derived>
191 template <
class Derived>
195 template <
class Derived>
200 template <
class Derived>
204 template <
class Derived>
208 template <
class Derived>
212 template <
class Derived>
216 template <
class Derived>
220 template <
class Derived>
225 template <
class Derived>
227 CRTP(Derived).sendNowImpl();
230 template <
class Derived>
232 sendKeyPressure(address, pressure);
234 template <
class Derived>
236 sendControlChange(address, value);
238 template <
class Derived>
240 sendProgramChange(address);
242 template <
class Derived>
244 sendProgramChange(address, value);
246 template <
class Derived>
248 sendChannelPressure(address, pressure);
250 template <
class Derived>
252 sendPitchBend(address, value);
#define CRTP(Derived)
Helper for the Curiously Recurring Template Pattern.
MIDIMessageType
All possible MIDI status byte values (without channel).
#define BEGIN_CS_NAMESPACE
A type-safe class for MIDI USB Cable numbers.
A type-safe class for MIDI channels.
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
constexpr uint8_t getAddress() const
Get the address [0, 127].
constexpr Channel getChannel() const
Get the channel [CHANNEL_1, CHANNEL_16].
constexpr Cable getCableNumber() const
Get the cable number [CABLE_1, CABLE_16].
A class for saving a MIDI channel and cable number.
constexpr Channel getChannel() const
Get the channel [1, 16].
constexpr Cable getCableNumber() const
Get the cable number [CABLE_1, CABLE_16].
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.
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.
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.
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.
void sendControlChange(MIDIAddress address, uint8_t value)
Send a MIDI Control Change event.
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.
void sendNoteOff(MIDIAddress address, uint8_t velocity)
Send a MIDI Note Off event.
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.
bool hasValidChannelMessageHeader() const
Check whether the header is a valid header for a channel message.
void sanitize()
Make sure that the status byte has the most significant bit set and the data bytes have the most sign...
void setData14bit(uint16_t data)
If Data 1 and Data 2 represent a single 14-bit number, you can use this method to set that number.
bool hasValidSystemCommonHeader() const
Check whether the header is a valid header for a System Common message.
bool isValid() const
Check whether the header is a valid header for a Real-Time message.