2 #include <Settings/SettingsWrapper.hpp>
8 DEBUG(
"MIDIUSB packet:\t" <<
hex << packet[0] <<
' ' << packet[1] <<
' '
9 << packet[2] <<
' ' << packet[3] <<
dec);
11 uint8_t CN = packet[0] >> 4;
16 constexpr uint8_t SysExEnd =
17 static_cast<uint8_t
>(MIDIMessageType::SYSEX_END);
18 constexpr uint8_t SysExStart =
19 static_cast<uint8_t
>(MIDIMessageType::SYSEX_START);
26 if (CIN >= MIDICodeIndexNumber::NOTE_OFF &&
27 CIN <= MIDICodeIndexNumber::PITCH_BEND) {
37 return MIDIReadEvent::CHANNEL_MESSAGE;
43 else if (CIN == MIDICodeIndexNumber::SYSEX_START_CONT) {
45 if (packet[1] == SysExStart)
49 DEBUGREF(
F(
"Error: No SysExStart received"));
50 return MIDIReadEvent::NO_MESSAGE;
55 return MIDIReadEvent::NO_MESSAGE;
60 else if (CIN == MIDICodeIndexNumber::SYSEX_END_1B) {
63 if (packet[1] != SysExEnd) {
65 return MIDIReadEvent::NO_MESSAGE;
67 DEBUGFN(
F(
"Error: No SysExStart received"));
68 return MIDIReadEvent::NO_MESSAGE;
72 return MIDIReadEvent::SYSEX_MESSAGE;
74 return MIDIReadEvent::NO_MESSAGE;
80 else if (CIN == MIDICodeIndexNumber::SYSEX_END_2B) {
82 if (packet[1] == SysExStart)
86 DEBUGFN(
F(
"Error: No SysExStart received"));
87 return MIDIReadEvent::NO_MESSAGE;
92 return MIDIReadEvent::SYSEX_MESSAGE;
94 return MIDIReadEvent::NO_MESSAGE;
99 else if (CIN == MIDICodeIndexNumber::SYSEX_END_3B) {
101 if (packet[1] == SysExStart)
105 DEBUGFN(
F(
"Error: No SysExStart received"));
106 return MIDIReadEvent::NO_MESSAGE;
113 return MIDIReadEvent::SYSEX_MESSAGE;
115 return MIDIReadEvent::NO_MESSAGE;
118 #endif // IGNORE_SYSEX
120 else if (CIN == MIDICodeIndexNumber::MISC_FUNCTION_CODES) {
123 }
else if (CIN == MIDICodeIndexNumber::CABLE_EVENTS) {
126 }
else if (CIN == MIDICodeIndexNumber::SYSTEM_COMMON_2B) {
129 }
else if (CIN == MIDICodeIndexNumber::SYSTEM_COMMON_3B) {
143 return MIDIReadEvent::NO_MESSAGE;