From acc4740ff858023e98b8dc54ed03a3ddf51b3cb2 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 6 Oct 2022 15:47:49 +0200 Subject: [PATCH] Added checking for midi channel when midi learning is activated. --- MicroDexed.ino | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 48fd033..c76b7ff 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -908,16 +908,23 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) { // check for MIDI learn mode if (midi_learn_var != NULL) { *midi_learn_var = inNumber; - if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note)) + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_drum_midi_note) && inChannel == configuration.drums.drum_midi_channel) LCDML.OTHER_jumpToFunc(UI_func_drum_midi_note); - else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_lowest_note)) { - if (inNumber > configuration.dexed[selected_instance_id].highest_note) - configuration.dexed[selected_instance_id].highest_note = inNumber; - LCDML.OTHER_jumpToFunc(UI_func_lowest_note); - } else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_highest_note)) - if (inNumber < configuration.dexed[selected_instance_id].lowest_note) - configuration.dexed[selected_instance_id].lowest_note = inNumber; - LCDML.OTHER_jumpToFunc(UI_func_highest_note); + else { + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + if (inChannel == configuration.dexed[selected_instance_id].midi_channel) { + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_lowest_note)) { + if (inNumber > configuration.dexed[selected_instance_id].highest_note) + configuration.dexed[selected_instance_id].highest_note = inNumber; + LCDML.OTHER_jumpToFunc(UI_func_lowest_note); + } else if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_highest_note)) { + if (inNumber < configuration.dexed[selected_instance_id].lowest_note) + configuration.dexed[selected_instance_id].lowest_note = inNumber; + LCDML.OTHER_jumpToFunc(UI_func_highest_note); + } + } + } + } } // Check for MicroDexed @@ -1006,9 +1013,9 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) { } #endif - // - // E-Piano - // +// +// E-Piano +// #if defined(USE_EPIANO) if (configuration.epiano.midi_channel == MIDI_CHANNEL_OMNI || configuration.epiano.midi_channel == inChannel) { if (inNumber >= configuration.epiano.lowest_note && inNumber <= configuration.epiano.highest_note) {