From 148ac0a652efe2eb11a7ff25dedfb46db5f1e6e2 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 30 Apr 2020 08:35:29 +0200 Subject: [PATCH] Fixing hanging notes when using a controller. --- MicroDexed.ino | 138 ++++++++++++++++++++++++++++++++++++++++++++----- UI.hpp | 2 - 2 files changed, 126 insertions(+), 14 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index bbbae5f..5f01837 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -598,6 +598,11 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #endif configuration.performance.bank[instance_id] = constrain((inValue << 7)&configuration.performance.bank[instance_id], 0, MAX_BANKS - 1); load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 1: #ifdef DEBUG @@ -635,6 +640,11 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #else dexed_level[instance_id]->gain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); #endif + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 10: // Pan #ifdef DEBUG @@ -642,6 +652,11 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #endif configuration.dexed[instance_id].pan = map(inValue, 0, 0x7f, PANORAMA_MIN, PANORAMA_MAX); mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_panorama)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 32: // BankSelect LSB #ifdef DEBUG @@ -649,6 +664,11 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #endif configuration.performance.bank[instance_id] = constrain(inValue, 0, MAX_BANKS - 1); load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 64: MicroDexed[instance_id]->setSustain(inValue > 63); @@ -666,31 +686,61 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) break; case 65: MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_mode)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; #if defined(USE_FX) case 103: // CC 103: filter resonance configuration.dexed[instance_id].filter_resonance = map(inValue, 0, 0x7f, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX); MicroDexed[instance_id]->fx.Reso = mapfloat(configuration.dexed[instance_id].filter_resonance, FILTER_RESONANCE_MIN, FILTER_RESONANCE_MAX, 1.0, 0.0); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_filter_resonance)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 104: // CC 104: filter cutoff configuration.dexed[instance_id].filter_cutoff = map(inValue, 0, 0x7f, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX); MicroDexed[instance_id]->fx.Cutoff = mapfloat(configuration.dexed[instance_id].filter_cutoff, FILTER_CUTOFF_MIN, FILTER_CUTOFF_MAX, 1.0, 0.0); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_filter_cutoff)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 105: // CC 105: delay time configuration.fx.delay_time = map(inValue, 0, 0x7f, DELAY_TIME_MIN, DELAY_TIME_MAX); delay_r.delay(0, configuration.fx.delay_time * 10); delay_l.delay(0, configuration.fx.delay_time * 10); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_time)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } case 106: // CC 106: delay feedback configuration.fx.delay_feedback = map(inValue, 0, 0x7f, DELAY_FEEDBACK_MIN , DELAY_FEEDBACK_MAX); //delay_fb_mixer_r.gain(0, 1.0); // original signal delay_fb_mixer_r.gain(1, mapfloat(configuration.fx.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback //delay_fb_mixer_l.gain(0, 1.0); // original signal delay_fb_mixer_l.gain(1, mapfloat(configuration.fx.delay_feedback, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0)); // amount of feedback + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_feedback)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 107: // CC 107: delay volume configuration.dexed[instance_id].delay_send = map(inValue, 0, 0x7f, DELAY_SEND_MIN, DELAY_SEND_MAX); master_mixer_r.gain(DELAY, mapfloat(configuration.fx.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); master_mixer_l.gain(DELAY, mapfloat(configuration.fx.delay_level, DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_delay_level)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; #endif case 120: @@ -709,9 +759,6 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) MicroDexed[instance_id]->setMonoMode(false); break; } - - LCDML.OTHER_updateFunc(); - LCDML.loop_menu(); } } } @@ -753,9 +800,11 @@ void handleProgramChange(byte inChannel, byte inProgram) #ifdef DISPLAY_LCD_SPI change_disp_sd(true); #endif - - LCDML.OTHER_updateFunc(); - LCDML.loop_menu(); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } } } } @@ -855,63 +904,125 @@ void handleSystemExclusive(byte * sysex, uint len) case 65: configuration.dexed[instance_id].pb_range = constrain(sysex[5], PB_RANGE_MIN, PB_RANGE_MAX); MicroDexed[instance_id]->controllers.values_[kControllerPitchRange] = configuration.dexed[instance_id].pb_range; + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_pb_range)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 66: configuration.dexed[instance_id].pb_step = constrain(sysex[5], PB_STEP_MIN, PB_STEP_MAX); MicroDexed[instance_id]->controllers.values_[kControllerPitchStep] = configuration.dexed[instance_id].pb_step; + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_pb_step)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 67: configuration.dexed[instance_id].portamento_mode = constrain(sysex[5], PORTAMENTO_MODE_MIN, PORTAMENTO_MODE_MAX); MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_mode)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 68: configuration.dexed[instance_id].portamento_glissando = constrain(sysex[5], PORTAMENTO_GLISSANDO_MIN, PORTAMENTO_GLISSANDO_MAX); MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_glissando)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 69: configuration.dexed[instance_id].portamento_time = constrain(sysex[5], PORTAMENTO_TIME_MIN, PORTAMENTO_TIME_MAX); MicroDexed[instance_id]->setPortamentoMode(configuration.dexed[instance_id].portamento_mode, configuration.dexed[instance_id].portamento_glissando, configuration.dexed[instance_id].portamento_time); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_portamento_time)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 70: configuration.dexed[instance_id].mw_range = constrain(sysex[5], MW_RANGE_MIN, MW_RANGE_MAX); MicroDexed[instance_id]->controllers.wheel.setRange(configuration.dexed[instance_id].mw_range); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_mw_range)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 71: configuration.dexed[instance_id].mw_assign = constrain(sysex[5], MW_ASSIGN_MIN, MW_ASSIGN_MAX); MicroDexed[instance_id]->controllers.wheel.setTarget(configuration.dexed[instance_id].mw_assign); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_mw_assign)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 72: configuration.dexed[instance_id].fc_range = constrain(sysex[5], FC_RANGE_MIN, FC_RANGE_MAX); MicroDexed[instance_id]->controllers.foot.setRange(configuration.dexed[instance_id].fc_range); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_fc_range)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 73: configuration.dexed[instance_id].fc_assign = constrain(sysex[5], FC_ASSIGN_MIN, FC_ASSIGN_MAX); MicroDexed[instance_id]->controllers.foot.setTarget(configuration.dexed[instance_id].fc_assign); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_fc_assign)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 74: configuration.dexed[instance_id].bc_range = constrain(sysex[5], BC_RANGE_MIN, BC_RANGE_MAX); MicroDexed[instance_id]->controllers.breath.setRange(configuration.dexed[instance_id].bc_range); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_bc_range)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 75: configuration.dexed[instance_id].bc_assign = constrain(sysex[5], BC_ASSIGN_MIN, BC_ASSIGN_MAX); MicroDexed[instance_id]->controllers.breath.setTarget(configuration.dexed[instance_id].bc_assign); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_bc_assign)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 76: configuration.dexed[instance_id].at_range = constrain(sysex[5], AT_RANGE_MIN, AT_RANGE_MAX); MicroDexed[instance_id]->controllers.at.setRange(configuration.dexed[instance_id].at_range); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_at_range)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; case 77: configuration.dexed[instance_id].at_assign = constrain(sysex[5], AT_ASSIGN_MIN, AT_ASSIGN_MAX); MicroDexed[instance_id]->controllers.at.setTarget(configuration.dexed[instance_id].at_assign); + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_at_assign)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } break; default: MicroDexed[instance_id]->data[sysex[4]] = sysex[5]; // set function parameter break; } MicroDexed[instance_id]->controllers.refresh(); - - LCDML.OTHER_updateFunc(); - LCDML.loop_menu(); } #ifdef DEBUG else @@ -981,9 +1092,12 @@ void handleSystemExclusive(byte * sysex, uint len) // show voice name strncpy(g_voice_name[instance_id], (char*)&sysex[151], VOICE_NAME_LEN - 1); - - LCDML.OTHER_updateFunc(); - LCDML.loop_menu(); + + if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_voice_select)) + { + LCDML.OTHER_updateFunc(); + LCDML.loop_menu(); + } } else if (len == 4104 && strlen(receive_bank_filename) > 0) { diff --git a/UI.hpp b/UI.hpp index 1b68dea..df2a6ac 100644 --- a/UI.hpp +++ b/UI.hpp @@ -143,10 +143,8 @@ enum {MENU_VOICE_BANK, MENU_VOICE_SOUND}; uint8_t menu_voice_select = MENU_VOICE_SOUND; void lcdml_menu_display(void); -void lcdml_voice_menu_display(void); void lcdml_menu_clear(void); void lcdml_menu_control(void); -void lcdml_voice_menu_control(void); #ifdef USE_FX void UI_func_reverb_roomsize(uint8_t param); void UI_func_reverb_damping(uint8_t param);