21 template <
class M
idiInterface>
25 template <
class M
idiInterface>
27 uint8_t channel = interface.getChannel() - 1;
28 this->midimsg.header = interface.getType() | channel;
29 this->midimsg.data1 = interface.getData1();
30 this->midimsg.data2 = interface.getData2();
35 template <
class M
idiInterface>
37 this->sysex.data = interface.getSysExArray();
38 this->sysex.length = interface.getSysExArrayLength();
43 template <
class M
idiInterface>
45 this->rtmsg.message = interface.getType();
76 template <
class M
idiInterface>
83 void begin()
override {
midi.begin(MIDI_CHANNEL_OMNI); }
87 return MIDIReadEvent::NO_MESSAGE;
88 auto type =
midi.getType();
89 if (
midi.isChannelMessage(type)) {
91 return MIDIReadEvent::CHANNEL_MESSAGE;
93 if (type == uint8_t(MIDIMessageType::SYSEX_START)) {
95 return MIDIReadEvent::SYSEX_MESSAGE;
97 if (type >= uint8_t(MIDIMessageType::TIMING_CLOCK)) {
101 return MIDIReadEvent::NO_MESSAGE;
105 void sendImpl(uint8_t header, uint8_t d1, uint8_t d2, uint8_t cn)
override {
106 uint8_t m = header & 0xF0;
107 uint8_t c = header & 0x0F;
109 midi.send(
static_cast<MIDI_NAMESPACE::MidiType
>(m), d1, d2, c + 1);
112 void sendImpl(uint8_t header, uint8_t d1, uint8_t cn)
override {
113 uint8_t m = header & 0xF0;
114 uint8_t c = header & 0x0F;
116 midi.send(
static_cast<MIDI_NAMESPACE::MidiType
>(m), d1, 0, c + 1);
120 void sendImpl(
const uint8_t *data,
size_t length, uint8_t cn) {
121 midi.sendSysEx(length, data,
true);
126 midi.sendRealTime(
static_cast<MIDI_NAMESPACE::MidiType
>(rt));