From 3b095746dea812e94a03c5956118e6c615aee56b Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 12 Jul 2021 13:54:30 +0200 Subject: [PATCH] Fixes for Mono/Poly-Mode. --- MicroDexed.ino | 53 ++++++++++++++++++++++++++------------------------ UI.hpp | 43 ++++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 46 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index ae13924..5ac5daf 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -301,6 +301,21 @@ void setup() #endif #endif +#ifdef DEBUG + generate_version_string(version_string, sizeof(version_string)); + + Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed")); + Serial.println(F("(c)2018-2021 H. Wirtz ")); + Serial.println(F("https://codeberg.org/dcoredump/MicroDexed")); + Serial.print(F("Version: ")); + Serial.println(version_string); + Serial.print(F("CPU-Speed: ")); + Serial.print(F_CPU / 1000000.0, 1); + Serial.println(F(" MHz")); + Serial.println(F("")); + Serial.flush(); +#endif + setup_midi_devices(); // Start audio system @@ -376,6 +391,17 @@ void setup() create_audio_engine_chain(instance_id); } +#ifdef DEBUG + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) + { + Serial.print(F("Instance ")); + Serial.print(instance_id); + Serial.print(F(": ")); + Serial.print(MicroDexed[instance_id]->getMaxNotes()); + Serial.println(F(" voices")); + } +#endif + #if defined(USE_FX) // Init effects for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) @@ -397,29 +423,6 @@ void setup() #endif #endif -#ifdef DEBUG - generate_version_string(version_string, sizeof(version_string)); - - Serial.println(F("MicroDexed based on https://github.com/asb2m10/dexed")); - Serial.println(F("(c)2018-2021 H. Wirtz ")); - Serial.println(F("https://codeberg.org/dcoredump/MicroDexed")); - Serial.print(F("Version: ")); - Serial.println(version_string); - Serial.print(F("CPU-Speed: ")); - Serial.print(F_CPU / 1000000.0, 1); - Serial.println(F(" MHz")); - for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) - { - Serial.print(F("Instance ")); - Serial.print(instance_id); - Serial.print(F(": ")); - Serial.print(MicroDexed[instance_id]->getMaxNotes()); - Serial.println(F(" voices")); - } - Serial.println(F("")); - Serial.flush(); -#endif - initial_values_from_eeprom(false); // start SD card @@ -1597,7 +1600,7 @@ void initial_values_from_eeprom(bool init) set_fx_params(); set_sys_params(); set_volume(configuration.sys.vol, configuration.sys.mono); - + #ifdef DEBUG show_configuration(); #endif @@ -1961,7 +1964,7 @@ void set_voiceconfig_params(uint8_t instance_id) MicroDexed[instance_id]->ControllersRefresh(); MicroDexed[instance_id]->setOPAll(configuration.dexed[instance_id].op_enabled); MicroDexed[instance_id]->doRefreshVoice(); - MicroDexed[instance_id]->setMonoMode(configuration.sys.mono); + MicroDexed[instance_id]->setMonoMode(configuration.dexed[instance_id].monopoly); // Dexed output level MicroDexed[instance_id]->setGain(mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); diff --git a/UI.hpp b/UI.hpp index e26026b..c4384ef 100644 --- a/UI.hpp +++ b/UI.hpp @@ -2307,35 +2307,36 @@ void UI_func_mono_poly(uint8_t param) if (LCDML.FUNC_loop()) // ****** LOOP ********* { - if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up()) || (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort())) + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { if (LCDML.BT_checkDown()) configuration.dexed[selected_instance_id].monopoly = constrain(configuration.dexed[selected_instance_id].monopoly + 1, MONOPOLY_MIN, MONOPOLY_MAX); else if (LCDML.BT_checkUp()) configuration.dexed[selected_instance_id].monopoly = constrain(configuration.dexed[selected_instance_id].monopoly - 1, MONOPOLY_MIN, MONOPOLY_MAX); -#if NUM_DEXED > 1 - else if (LCDML.BT_checkEnter()) - { - selected_instance_id = !selected_instance_id; - lcd_active_instance_number(selected_instance_id); - UI_update_instance_icons(); - } - lcd_active_instance_number(selected_instance_id); -#endif - } - MicroDexed[selected_instance_id]->setMonoMode(!configuration.dexed[selected_instance_id].monopoly); - - lcd.setCursor(0, 1); - switch (configuration.dexed[selected_instance_id].monopoly) + MicroDexed[selected_instance_id]->setMonoMode(!configuration.dexed[selected_instance_id].monopoly); + configuration.dexed[selected_instance_id].monopoly = MicroDexed[selected_instance_id]->getMonoMode(); + } +#if NUM_DEXED > 1 + if (LCDML.BT_checkEnter() && encoderDir[ENC_R].ButtonShort()) { - case 0: - lcd.print(F("[MONOPHONIC]")); - break; - case 1: - lcd.print(F("[POLYPHONIC]")); - break; + selected_instance_id = !selected_instance_id; + lcd_active_instance_number(selected_instance_id); + UI_update_instance_icons(); } + lcd_active_instance_number(selected_instance_id); +#endif + } + + lcd.setCursor(0, 1); + switch (configuration.dexed[selected_instance_id].monopoly) + { + case 1: + lcd.print(F("[MONOPHONIC]")); + break; + case 0: + lcd.print(F("[POLYPHONIC]")); + break; } if (LCDML.FUNC_close()) // ****** STABLE END *********