diff --git a/MicroDexed.ino b/MicroDexed.ino index 3dffaf1..afd6cc0 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -215,6 +215,8 @@ const uint8_t mosi_pins[] = { SDCARD_TEENSY_MOSI_PIN, SDCARD_AUDIO_MOSI_PIN }; const uint8_t sck_pins[] = { SDCARD_TEENSY_SCK_PIN, SDCARD_AUDIO_SCK_PIN }; char version_string[LCD_cols + 1]; char sd_string[LCD_cols + 1]; +char g_voice_name[NUM_DEXED][VOICE_NAME_LEN]; +char g_bank_name[NUM_DEXED][BANK_NAME_LEN]; #if defined(USE_FX) // Allocate the delay lines for chorus @@ -378,6 +380,9 @@ void setup() { // load default SYSEX data load_sd_voice(configuration.performance.bank[instance_id], configuration.performance.voice[instance_id], instance_id); + + memset(g_voice_name[instance_id], 0, VOICE_NAME_LEN); + memset(g_bank_name[instance_id], 0, BANK_NAME_LEN); } } @@ -962,6 +967,9 @@ void handleSystemExclusive(byte * sysex, uint len) // load sysex-data into voice memory MicroDexed[instance_id]->loadVoiceParameters(&sysex[6]); + // show voice name + strncpy(g_voice_name[instance_id], (char*)&sysex[151], VOICE_NAME_LEN - 1); + LCDML.OTHER_updateFunc(); LCDML.loop_menu(); diff --git a/UI.hpp b/UI.hpp index 20ad64e..3fadddd 100644 --- a/UI.hpp +++ b/UI.hpp @@ -87,6 +87,8 @@ extern AudioAmplifier* dexed_level[NUM_DEXED]; extern AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; extern AudioSynthWaveformDc* pan[NUM_DEXED]; extern char sd_string[LCD_cols + 1]; +extern char g_voice_name[NUM_DEXED][VOICE_NAME_LEN]; +extern char g_bank_name[NUM_DEXED][BANK_NAME_LEN]; /*********************************************************************** GLOBAL @@ -3288,6 +3290,7 @@ void UI_func_voice_select(uint8_t param) switch (menu_voice_select) { case MENU_VOICE_BANK: + memset(g_bank_name[instance_id], 0, BANK_NAME_LEN); bank_tmp = constrain(configuration.performance.bank[instance_id] - ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); configuration.performance.bank[instance_id] = bank_tmp; #ifdef DISPLAY_LCD_SPI @@ -3299,6 +3302,7 @@ void UI_func_voice_select(uint8_t param) #endif break; case MENU_VOICE_SOUND: + memset(g_voice_name[instance_id], 0, VOICE_NAME_LEN); voice_tmp = configuration.performance.voice[instance_id] - ENCODER[ENC_R].speed(); if (voice_tmp < 0 && configuration.performance.bank[instance_id] - 1 >= 0) { @@ -3328,6 +3332,7 @@ void UI_func_voice_select(uint8_t param) switch (menu_voice_select) { case MENU_VOICE_BANK: + memset(g_bank_name[instance_id], 0, BANK_NAME_LEN); bank_tmp = constrain(configuration.performance.bank[instance_id] + ENCODER[ENC_R].speed(), 0, MAX_BANKS - 1); configuration.performance.bank[instance_id] = bank_tmp; #ifdef DISPLAY_LCD_SPI @@ -3339,6 +3344,7 @@ void UI_func_voice_select(uint8_t param) #endif break; case MENU_VOICE_SOUND: + memset(g_voice_name[instance_id], 0, VOICE_NAME_LEN); voice_tmp = configuration.performance.voice[instance_id] + ENCODER[ENC_R].speed(); if (voice_tmp >= MAX_VOICES && configuration.performance.bank[instance_id] + 1 < MAX_BANKS) { @@ -3371,10 +3377,25 @@ void UI_func_voice_select(uint8_t param) } } - if (!get_bank_name(configuration.performance.bank[instance_id], bank_name, sizeof(bank_name))) - strncpy(bank_name, "*ERROR*", sizeof(bank_name)); - if (!get_voice_by_bank_name(configuration.performance.bank[instance_id], bank_name, configuration.performance.voice[instance_id], voice_name, sizeof(voice_name))) - strncpy(voice_name, "*ERROR*", sizeof(voice_name)); + if (strlen(g_bank_name[instance_id]) > 0) + { + strncpy(bank_name, g_bank_name[instance_id], sizeof(bank_name)); + } + else + { + if (!get_bank_name(configuration.performance.bank[instance_id], bank_name, sizeof(bank_name))) + strncpy(bank_name, "*ERROR*", sizeof(bank_name)); + } + + if (strlen(g_voice_name[instance_id]) > 0) + { + strncpy(voice_name, g_voice_name[instance_id], sizeof(voice_name)); + } + else + { + if (!get_voice_by_bank_name(configuration.performance.bank[instance_id], bank_name, configuration.performance.voice[instance_id], voice_name, sizeof(voice_name))) + strncpy(voice_name, "*ERROR*", sizeof(voice_name)); + } lcd.show(0, 0, 2, configuration.performance.bank[instance_id]); lcd.show(1, 0, 2, configuration.performance.voice[instance_id] + 1);