diff --git a/MicroDexed.ino b/MicroDexed.ino index 40fcf6d..03d425e 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -675,7 +675,8 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) #ifdef DEBUG Serial.println(F("BANK-SELECT CC")); #endif - configuration.performance.bank[instance_id] = inValue; + 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); break; case 64: MicroDexed[instance_id]->setSustain(inValue > 63); @@ -769,16 +770,14 @@ void handleProgramChange(byte inChannel, byte inProgram) { if (checkMidiChannel(inChannel, instance_id)) { - if (inProgram < MAX_VOICES - 1) - { + configuration.performance.voice[instance_id] = constrain(inProgram, 0, MAX_VOICES - 1); #ifdef DISPLAY_LCD_SPI - change_disp_sd(false); + change_disp_sd(false); #endif - load_sd_voice(configuration.performance.bank[instance_id], inProgram, instance_id); + load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); #ifdef DISPLAY_LCD_SPI - change_disp_sd(true); + change_disp_sd(true); #endif - } } } } @@ -1185,7 +1184,9 @@ void initial_values_from_eeprom(bool init) for (uint8_t i = 0; i < NUM_DEXED; i++) eeprom_get_dexed(i); +#ifdef DEBUG show_configuration(); +#endif check_configuration(); diff --git a/UI.hpp b/UI.hpp index bf1e9a2..e37c21b 100644 --- a/UI.hpp +++ b/UI.hpp @@ -473,6 +473,7 @@ void lcdml_menu_control(void) ENCODER[ENC_L].begin(); } + //if (back_from_volume > BACK_FROM_VOLUME_MS && LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_volume)) if (back_from_volume > BACK_FROM_VOLUME_MS && LCDML.FUNC_getID() == VOLUME_MENU_ID) { encoderDir[ENC_L].reset(); @@ -602,6 +603,7 @@ void lcdml_menu_control(void) #endif encoderDir[ENC_L].Down(true); LCDML.BT_down(); + //if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_volume)) if (LCDML.FUNC_getID() != VOLUME_MENU_ID) { LCDML.OTHER_jumpToFunc(UI_func_volume); @@ -628,6 +630,7 @@ void lcdml_menu_control(void) #endif encoderDir[ENC_L].Up(true); LCDML.BT_up(); + //if (LCDML.FUNC_getID() != LCDML.OTHER_getIDFromFunction(UI_func_volume)) if (LCDML.FUNC_getID() != VOLUME_MENU_ID) { LCDML.OTHER_jumpToFunc(UI_func_volume); @@ -658,6 +661,8 @@ void lcdml_menu_control(void) #endif //encoderDir[ENC_L].ButtonLong(true); //LCDML.BT_quit(); + for (uint8_t i = 0; i < NUM_DEXED; i++) + MicroDexed[i]->panic(); } else if ((millis() - g_LCDML_CONTROL_button_press_time[ENC_L]) >= g_LCDML_CONTROL_button_short_press) { @@ -3412,6 +3417,8 @@ void UI_func_load_performance(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { + char tmp[10]; + mode = 0; encoderDir[ENC_R].reset(); @@ -3419,14 +3426,8 @@ void UI_func_load_performance(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Load Perf. SD")); lcd.setCursor(0, 1); - if (configuration.sys.performance_number == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.sys.performance_number); - lcd.print(tmp); - } + sprintf(tmp, "[%2d]", configuration.sys.performance_number); + lcd.print(tmp); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -3469,14 +3470,9 @@ void UI_func_load_performance(uint8_t param) } lcd.setCursor(0, 1); - if (configuration.sys.performance_number == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.sys.performance_number); - lcd.print(tmp); - } + char tmp[10]; + sprintf(tmp, "[%2d]", configuration.sys.performance_number); + lcd.print(tmp); } } @@ -3503,6 +3499,8 @@ void UI_func_save_performance(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { + char tmp[FILENAME_LEN]; + yesno = false; mode = 0; @@ -3511,16 +3509,9 @@ void UI_func_save_performance(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Save Perf. SD")); lcd.setCursor(0, 1); - if (configuration.sys.performance_number == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.sys.performance_number); - lcd.print(tmp); - } + sprintf(tmp, "[%2d]", configuration.sys.performance_number); + lcd.print(tmp); - char tmp[FILENAME_LEN]; sprintf(tmp, "/%s/%s%d.syx", PERFORMANCE_CONFIG_PATH, PERFORMANCE_CONFIG_NAME, configuration.sys.performance_number); if (SD.exists(tmp)) overwrite = true; @@ -3585,14 +3576,8 @@ void UI_func_save_performance(uint8_t param) overwrite = false; lcd.setCursor(0, 1); - if (configuration.sys.performance_number == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.sys.performance_number); - lcd.print(tmp); - } + sprintf(tmp, "[%2d]", configuration.sys.performance_number); + lcd.print(tmp); } else { @@ -3631,6 +3616,8 @@ void UI_func_load_voiceconfig(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { + char tmp[10]; + instance_id = 0; encoderDir[ENC_R].reset(); @@ -3644,14 +3631,8 @@ void UI_func_load_voiceconfig(uint8_t param) #else mode = 1; lcd.setCursor(0, 1); - if (configuration.performance.voiceconfig_number[instance_id] == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.performance.voiceconfig_number[instance_id]); - lcd.print(tmp); - } + sprintf(tmp, "[%2d]", configuration.performance.voiceconfig_number[instance_id]); + lcd.print(tmp); #endif } @@ -3695,14 +3676,9 @@ void UI_func_load_voiceconfig(uint8_t param) else if (mode == 1) { lcd.setCursor(0, 1); - if (configuration.performance.voiceconfig_number[instance_id] == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.performance.voiceconfig_number[instance_id]); - lcd.print(tmp); - } + char tmp[10]; + sprintf(tmp, "[%2d]", configuration.performance.voiceconfig_number[instance_id]); + lcd.print(tmp); } } encoderDir[ENC_R].reset(); @@ -3737,6 +3713,8 @@ void UI_func_save_voiceconfig(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { + char tmp[FILENAME_LEN]; + yesno = false; instance_id = 0; @@ -3751,16 +3729,9 @@ void UI_func_save_voiceconfig(uint8_t param) #else mode = 1; lcd.setCursor(0, 1); - if (configuration.performance.voiceconfig_number[instance_id] == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.performance.voiceconfig_number[instance_id]); - lcd.print(tmp); - } + sprintf(tmp, "[%2d]", configuration.performance.voiceconfig_number[instance_id]); + lcd.print(tmp); - char tmp[FILENAME_LEN]; sprintf(tmp, "/%s/%s%d.syx", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, configuration.performance.voiceconfig_number[instance_id]); if (SD.exists(tmp)) overwrite = true; @@ -3828,6 +3799,7 @@ void UI_func_save_voiceconfig(uint8_t param) else if (mode == 1) { char tmp[FILENAME_LEN]; + sprintf(tmp, "/%s/%s%d.syx", VOICE_CONFIG_PATH, VOICE_CONFIG_NAME, configuration.performance.voiceconfig_number[instance_id]); if (SD.exists(tmp)) overwrite = true; @@ -3835,14 +3807,8 @@ void UI_func_save_voiceconfig(uint8_t param) overwrite = false; lcd.setCursor(0, 1); - if (configuration.performance.voiceconfig_number[instance_id] == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.performance.voiceconfig_number[instance_id]); - lcd.print(tmp); - } + sprintf(tmp, "[%2d]", configuration.performance.voiceconfig_number[instance_id]); + lcd.print(tmp); } else if (mode == 2) { @@ -3875,6 +3841,8 @@ void UI_func_load_fx(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { + char tmp[10]; + mode = 0; encoderDir[ENC_R].reset(); @@ -3882,14 +3850,8 @@ void UI_func_load_fx(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Load FX SD")); lcd.setCursor(0, 1); - if (configuration.performance.fx_number == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.performance.fx_number); - lcd.print(tmp); - } + sprintf(tmp, "[%7d]", configuration.performance.fx_number); + lcd.print(tmp); } if (LCDML.FUNC_loop()) // ****** LOOP ********* @@ -3920,14 +3882,9 @@ void UI_func_load_fx(uint8_t param) } lcd.setCursor(0, 1); - if (configuration.performance.fx_number == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.performance.fx_number); - lcd.print(tmp); - } + char tmp[10]; + sprintf(tmp, "[%2d]", configuration.performance.fx_number); + lcd.print(tmp); } } @@ -3954,6 +3911,8 @@ void UI_func_save_fx(uint8_t param) if (LCDML.FUNC_setup()) // ****** SETUP ********* { + char tmp[FILENAME_LEN]; + yesno = false; mode = 0; @@ -3962,16 +3921,9 @@ void UI_func_save_fx(uint8_t param) lcd.setCursor(0, 0); lcd.print(F("Save FX")); lcd.setCursor(0, 1); - if (configuration.performance.fx_number == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.performance.fx_number); - lcd.print(tmp); - } + sprintf(tmp, "[%7d]", configuration.performance.fx_number); + lcd.print(tmp); - char tmp[FILENAME_LEN]; sprintf(tmp, "/%s/%s%d.syx", FX_CONFIG_PATH, FX_CONFIG_NAME, configuration.performance.fx_number); if (SD.exists(tmp)) overwrite = true; @@ -4036,14 +3988,8 @@ void UI_func_save_fx(uint8_t param) overwrite = false; lcd.setCursor(0, 1); - if (configuration.performance.fx_number == 0) - lcd.print(F("[DEFAULT]")); - else - { - char tmp[10]; - sprintf(tmp, "[%7d]", configuration.performance.fx_number); - lcd.print(tmp); - } + sprintf(tmp, "[%2d]", configuration.performance.fx_number); + lcd.print(tmp); } else { diff --git a/UI_1_FX.h b/UI_1_FX.h index 31b8d64..6bcb9fe 100644 --- a/UI_1_FX.h +++ b/UI_1_FX.h @@ -99,8 +99,8 @@ LCDML_add(70, LCDML_0_2_3, 2, "Damping", UI_func_reverb_damping); LCDML_add(71, LCDML_0_2_3, 3, "Level", UI_func_reverb_level); LCDML_add(72, LCDML_0, 3, "Load/Save", NULL); LCDML_add(73, LCDML_0_3, 1, "Performance", NULL); -LCDML_add(74, LCDML_0_3_1, 1, "Load Performance", UI_func_load_performance); -LCDML_add(75, LCDML_0_3_1, 2, "Save Performance", UI_func_save_performance); +LCDML_add(74, LCDML_0_3_1, 1, "Load Perf.", UI_func_load_performance); +LCDML_add(75, LCDML_0_3_1, 2, "Save Perf.", UI_func_save_performance); LCDML_add(76, LCDML_0_3, 2, "Voice Config", NULL); LCDML_add(77, LCDML_0_3_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig); LCDML_add(78, LCDML_0_3_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig); diff --git a/config.h b/config.h index 712047d..b871419 100644 --- a/config.h +++ b/config.h @@ -221,9 +221,9 @@ #define MAX_BANKS 100 #define MAX_VOICES 32 // voices per bank -#define MAX_FX 15 -#define MAX_PERFORMANCE 15 -#define MAX_VOICECONFIG 15 +#define MAX_FX 99 +#define MAX_PERFORMANCE 99 +#define MAX_VOICECONFIG 99 #define BANK_NAME_LEN 13 // FAT12 filenames (plus '\0') #define VOICE_NAME_LEN 11 // 10 (plus '\0') #define FILENAME_LEN BANK_NAME_LEN + VOICE_NAME_LEN