From 5aa25df360f1386adcf0518141339d9d42e0a379 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Wed, 18 Jul 2018 10:46:32 +0200 Subject: [PATCH] Added checking for MIDI channel (and ignoring everything that is not our MIDI channel). When using MASTER_KEY every notes are turned off. Moved MASTER_KEY one octave up. --- MicroDexed.ino | 12 +++++++++++- config.h | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 98e4728..9bff047 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -399,7 +399,16 @@ bool queue_midi_event(uint8_t type, uint8_t data1, uint8_t data2) print_midi_event(type, data1, data2); #endif - type = type & 0xf0; + // check for MIDI channel + if (midi_channel != MIDI_CHANNEL_OMNI) + { + uint8_t c = type & 0x0f; + if (c != midi_channel) + return (true); + } + + // now throw away the MIDI channel information + type &= 0xf0; #ifdef MASTER_KEY_MIDI if (type == 0x80 && data1 == MASTER_KEY_MIDI) // Master key released @@ -411,6 +420,7 @@ bool queue_midi_event(uint8_t type, uint8_t data1, uint8_t data2) } else if (type == 0x90 && data1 == MASTER_KEY_MIDI) // Master key pressed { + dexed->notesOff(); master_key_enabled = true; #ifdef DEBUG Serial.println(F("Master key enabled")); diff --git a/config.h b/config.h index 6eb0042..6f2bc12 100644 --- a/config.h +++ b/config.h @@ -42,8 +42,8 @@ #endif // Master key handling (comment for disabling) -#define MASTER_KEY_MIDI MIDI_C6 -#define MASTER_NUM1 MIDI_C1 +#define MASTER_KEY_MIDI MIDI_C7 +#define MASTER_NUM1 MIDI_C2 // Debug output #define SERIAL_SPEED 38400