29enum class MIDIMatchType { NO_MATCH, CHANNEL, MPE_MEMBER, MPE_MASTER };
35 constexpr bool equalsCable(
MIDICable* newCable)
const {
36 return (!MIDIDeviceManager::differentiatingInputsByDevice || !cable || newCable == cable);
39 constexpr bool equalsChannelOrZone(
MIDICable* newCable, int32_t newChannelOrZone)
const {
40 return (newChannelOrZone == channelOrZone && equalsCable(newCable));
43 constexpr bool equalsNoteOrCC(
MIDICable* newCable, int32_t newChannel, int32_t newNoteOrCC)
const {
44 return (newNoteOrCC == noteOrCC && equalsChannelOrZone(newCable, newChannel));
47 bool equalsChannelAllowMPE(
MIDICable* newCable, int32_t newChannel);
48 bool equalsChannelAllowMPEMasterChannels(
MIDICable* newCable, int32_t newChannel);
51 inline bool equalsNoteOrCCAllowMPE(
MIDICable* newCable, int32_t newChannel, int32_t newNoteOrCC) {
52 return (newNoteOrCC == noteOrCC && equalsChannelAllowMPE(newCable, newChannel));
55 inline bool equalsNoteOrCCAllowMPEMasterChannels(
MIDICable* newCable, int32_t newChannel, int32_t newNoteOrCC) {
56 return (newNoteOrCC == noteOrCC && equalsChannelAllowMPEMasterChannels(newCable, newChannel));
58 MIDIMatchType checkMatch(
MIDICable* fromCable, int32_t channel);
59 inline bool containsSomething() {
return (channelOrZone != MIDI_CHANNEL_NONE); }
62 inline bool isForMPEZone() {
return (channelOrZone >= 16); }
65 inline int32_t getMasterChannel() {
return (channelOrZone - MIDI_CHANNEL_MPE_LOWER_ZONE) * 15; }
67 void writeAttributesToFile(
Serializer& writer, int32_t midiMessageType);
68 void writeToFile(
Serializer& writer,
char const* commandName,
69 int32_t midiMessageType);
70 void readFromFile(
Deserializer& reader, int32_t midiMessageType);
72 inline void writeNoteToFile(
Serializer& writer,
char const* commandName) {
73 writeToFile(writer, commandName, MIDI_MESSAGE_NOTE);
75 inline void writeCCToFile(
Serializer& writer,
char const* commandName) {
76 writeToFile(writer, commandName, MIDI_MESSAGE_CC);
78 inline void writeChannelToFile(
Serializer& writer,
char const* commandName) {
79 writeToFile(writer, commandName, MIDI_MESSAGE_NONE);
82 inline void readNoteFromFile(
Deserializer& reader) { readFromFile(reader, MIDI_MESSAGE_NOTE); }
83 inline void readCCFromFile(
Deserializer& reader) { readFromFile(reader, MIDI_MESSAGE_CC); }
84 inline void readChannelFromFile(
Deserializer& reader) { readFromFile(reader, MIDI_MESSAGE_NONE); }
92 uint8_t channelOrZone;