From af91adffcda7c8f812a1edcee195827368abf37d Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 21 Apr 2020 14:42:56 +0200 Subject: [PATCH] Small fixes. --- MicroDexed.ino | 20 ++++++++++---------- UI.hpp | 26 ++++++++++++++++++++++++-- UI_1_FX.h | 16 ++++++++-------- UI_2_FX.h | 22 +++++++++++----------- 4 files changed, 53 insertions(+), 31 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 03d425e..0603bb6 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -479,7 +479,6 @@ void setup() Serial.println(F("]")); Serial.print(F("Polyphony: ")); Serial.println(configuration.dexed[instance_id].polyphony, DEC); - //show_patch(instance_id); } Serial.print(F("AUDIO_BLOCK_SAMPLES=")); @@ -1245,7 +1244,8 @@ void check_configuration(void) configuration.sys.vol = constrain(configuration.sys.vol, VOLUME_MIN, VOLUME_MAX); configuration.sys.mono = constrain(configuration.sys.mono, MONO_MIN, MONO_MAX); configuration.sys.soft_midi_thru = constrain(configuration.sys.soft_midi_thru, SOFT_MIDI_THRU_MIN, SOFT_MIDI_THRU_MAX); - + configuration.sys.performance_number = constrain(configuration.sys.performance_number, PERFORMANCE_NUM_MIN, PERFORMANCE_NUM_MAX); + configuration.performance.fx_number = constrain(configuration.performance.fx_number, FX_NUM_MIN, FX_NUM_MAX); configuration.fx.reverb_roomsize = constrain(configuration.fx.reverb_roomsize, REVERB_ROOMSIZE_MIN, REVERB_ROOMSIZE_MAX); @@ -1277,7 +1277,11 @@ void check_configuration(void) configuration.dexed[instance_id].pan = constrain(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX); configuration.dexed[instance_id].transpose = constrain(configuration.dexed[instance_id].transpose, TRANSPOSE_MIN, TRANSPOSE_MAX); configuration.dexed[instance_id].tune = constrain(configuration.dexed[instance_id].tune, TUNE_MIN, TUNE_MAX); +#if NUM_DEXED > 1 + configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX / 2); +#else configuration.dexed[instance_id].polyphony = constrain(configuration.dexed[instance_id].polyphony, POLYPHONY_MIN, POLYPHONY_MAX); +#endif configuration.dexed[instance_id].velocity_level = constrain(configuration.dexed[instance_id].velocity_level, VELOCITY_LEVEL_MIN, VELOCITY_LEVEL_MAX); configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine, ENGINE_MIN, ENGINE_MAX); configuration.dexed[instance_id].monopoly = constrain(configuration.dexed[instance_id].monopoly, MONOPOLY_MIN, MONOPOLY_MAX); @@ -1316,14 +1320,12 @@ void init_configuration(void) Serial.println(F("INITIALIZING CONFIGURATION")); #endif - //configuration.sys.checksum = 0xffff; configuration.sys.instances = INSTANCES_DEFAULT; configuration.sys.vol = VOLUME_DEFAULT; configuration.sys.mono = MONO_DEFAULT; configuration.sys.soft_midi_thru = SOFT_MIDI_THRU_DEFAULT; configuration.sys.performance_number = PERFORMANCE_NUM_DEFAULT; - //configuration.fx.checksum = 0xffff; configuration.fx.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT; configuration.fx.reverb_damping = REVERB_DAMPING_DEFAULT; configuration.fx.reverb_level = REVERB_LEVEL_DEFAULT; @@ -1344,7 +1346,6 @@ void init_configuration(void) configuration.performance.voice[instance_id] = SYSEXSOUND_DEFAULT; configuration.performance.voiceconfig_number[instance_id] = VOICECONFIG_NUM_DEFAULT; - //configuration.dexed[instance_id].checksum = 0xffff; configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL; configuration.dexed[instance_id].lowest_note = INSTANCE_LOWEST_NOTE_MIN; configuration.dexed[instance_id].highest_note = INSTANCE_HIGHEST_NOTE_MAX; @@ -1358,10 +1359,14 @@ void init_configuration(void) configuration.dexed[instance_id].transpose = TRANSPOSE_DEFAULT; configuration.dexed[instance_id].tune = TUNE_DEFAULT; +#if NUM_DEXED > 1 + configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT / 2; +#else if (instance_id == 0) configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT; else configuration.dexed[instance_id].polyphony = 0; +#endif configuration.dexed[instance_id].velocity_level = VELOCITY_LEVEL_DEFAULT; configuration.dexed[instance_id].engine = ENGINE_DEFAULT; @@ -1483,7 +1488,6 @@ bool eeprom_get_dexed(uint8_t instance_id) void eeprom_update_performance() { - //configuration.performance.checksum = crc32((byte*)&configuration.performance + 4, sizeof(configuration.performance) - 4); EEPROM.put(EEPROM_START_ADDRESS + offsetof(configuration_s, performance), configuration.performance); #ifdef DEBUG Serial.println(F("Updating EEPROM performance.")); @@ -1906,13 +1910,11 @@ void show_configuration(void) Serial.println(); Serial.println(F("CONFIGURATION:")); Serial.println(F("System")); - //Serial.print(F(" Checksum 0x")); Serial.println(configuration.sys.checksum, HEX); Serial.print(F(" Instances ")); Serial.println(configuration.sys.instances, DEC); Serial.print(F(" Volume ")); Serial.println(configuration.sys.vol, DEC); Serial.print(F(" Mono ")); Serial.println(configuration.sys.mono, DEC); Serial.print(F(" Soft MIDI Thru ")); Serial.println(configuration.sys.soft_midi_thru, DEC); Serial.println(F("FX")); - //Serial.print(F(" Checksum 0x")); Serial.println(configuration.fx.checksum, HEX); Serial.print(F(" Reverb Roomsize ")); Serial.println(configuration.fx.reverb_roomsize, DEC); Serial.print(F(" Reverb Damping ")); Serial.println(configuration.fx.reverb_damping, DEC); Serial.print(F(" Reverb Level ")); Serial.println(configuration.fx.reverb_level, DEC); @@ -1928,7 +1930,6 @@ void show_configuration(void) { Serial.print(F("Dexed instance ")); Serial.println(instance_id, DEC); - //Serial.print(F(" Checksum 0x")); Serial.println(configuration.dexed[instance_id].checksum, HEX); Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.dexed[instance_id].midi_channel, DEC); Serial.print(F(" Lowest Note ")); Serial.println(configuration.dexed[instance_id].lowest_note, DEC); Serial.print(F(" Highest Note ")); Serial.println(configuration.dexed[instance_id].highest_note, DEC); @@ -1967,7 +1968,6 @@ void show_configuration(void) } Serial.println(F("Performance")); - //Serial.print(F(" Checksum 0x")); Serial.println(configuration.performance.checksum, HEX); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { Serial.print(F(" Bank ")); Serial.print(instance_id, DEC); Serial.print(" "); Serial.println(configuration.performance.bank[instance_id], DEC); diff --git a/UI.hpp b/UI.hpp index 8a62280..7d1ee43 100644 --- a/UI.hpp +++ b/UI.hpp @@ -476,6 +476,9 @@ void lcdml_menu_control(void) //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) { + Serial.print("LCDML.FUNC_getID()="); Serial.println(LCDML.FUNC_getID()); + Serial.print("LCDML.OTHER_getIDFromFunction(UI_func_volume)="); Serial.println(LCDML.OTHER_getIDFromFunction(UI_func_volume)); + encoderDir[ENC_L].reset(); encoderDir[ENC_R].reset(); @@ -483,6 +486,7 @@ void lcdml_menu_control(void) LCDML.OTHER_jumpToID(LCDML.MENU_getLastActiveFunctionID()); else LCDML.OTHER_setCursorToID(LCDML.MENU_getLastCursorPositionID()); + //LCDML.FUNC_goBackToMenu(); } // Volatile Variables @@ -3190,8 +3194,6 @@ void UI_func_eeprom_reset(uint8_t param) } } -extern void show_configuration(void); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - void UI_func_voice_select(uint8_t param) { uint8_t instance_id = 0; @@ -3600,6 +3602,8 @@ void UI_func_save_performance(uint8_t param) delay(500); } + EEPROM.update(EEPROM_START_ADDRESS + offsetof(sys_s, performance_number), configuration.sys.performance_number); + encoderDir[ENC_R].reset(); } } @@ -3695,6 +3699,13 @@ void UI_func_load_voiceconfig(uint8_t param) else eeprom_update_dexed(instance_id); +#if NUM_DEXED > 1 + if (instance_id > 0) + EEPROM.update(EEPROM_START_ADDRESS + offsetof(performance_s, voiceconfig_number[1]), configuration.performance.voiceconfig_number[1]); + else +#endif + EEPROM.update(EEPROM_START_ADDRESS + offsetof(performance_s, voiceconfig_number[0]), configuration.performance.voiceconfig_number[0]); + encoderDir[ENC_R].reset(); } } @@ -3831,6 +3842,13 @@ void UI_func_save_voiceconfig(uint8_t param) delay(500); } +#if NUM_DEXED > 1 + if (instance_id > 0) + EEPROM.update(EEPROM_START_ADDRESS + offsetof(performance_s, voiceconfig_number[1]), configuration.performance.voiceconfig_number[1]); + else +#endif + EEPROM.update(EEPROM_START_ADDRESS + offsetof(performance_s, voiceconfig_number[0]), configuration.performance.voiceconfig_number[0]); + encoderDir[ENC_R].reset(); } } @@ -3899,6 +3917,8 @@ void UI_func_load_fx(uint8_t param) else eeprom_update_fx(); + EEPROM.update(EEPROM_START_ADDRESS + offsetof(performance_s, fx_number), configuration.performance.fx_number); + encoderDir[ENC_R].reset(); } } @@ -4012,6 +4032,8 @@ void UI_func_save_fx(uint8_t param) delay(500); } + EEPROM.update(EEPROM_START_ADDRESS + offsetof(performance_s, fx_number), configuration.performance.fx_number); + encoderDir[ENC_R].reset(); } } diff --git a/UI_1_FX.h b/UI_1_FX.h index 6bcb9fe..11d5caa 100644 --- a/UI_1_FX.h +++ b/UI_1_FX.h @@ -30,10 +30,10 @@ LCDML_add(1, LCDML_0_1, 1, "Select", UI_func_voice_select); LCDML_add(2, LCDML_0_1, 2, "Audio", NULL); LCDML_add(3, LCDML_0_1_2, 1, "Voice Level", UI_func_sound_intensity); LCDML_add(4, LCDML_0_1_2, 2, "Panorama", UI_func_panorama); -LCDML_add(5, LCDML_0_1_2, 3, "Effect Send", NULL); -LCDML_add(6, LCDML_0_1_2_3, 1, "Reverb Send", UI_func_reverb_send); -LCDML_add(7, LCDML_0_1_2_3, 2, "Chorus Send", UI_func_chorus_send); -LCDML_add(8, LCDML_0_1_2_3, 3, "Delay Send", UI_func_delay_send); +LCDML_add(5, LCDML_0_1_2, 3, "Effects Send", NULL); +LCDML_add(6, LCDML_0_1_2_3, 1, "Chorus Send", UI_func_chorus_send); +LCDML_add(7, LCDML_0_1_2_3, 2, "Delay Send", UI_func_delay_send); +LCDML_add(8, LCDML_0_1_2_3, 3, "Reverb Send", UI_func_reverb_send); LCDML_add(9, LCDML_0_1_2, 4, "Filter", NULL); LCDML_add(10, LCDML_0_1_2_4, 1, "Cutoff", UI_func_filter_cutoff); LCDML_add(11, LCDML_0_1_2_4, 2, "Resonance", UI_func_filter_resonance); @@ -83,7 +83,7 @@ LCDML_add(54, LCDML_0_1_7, 3, "OP3", UI_func_OP3); LCDML_add(55, LCDML_0_1_7, 4, "OP4", UI_func_OP4); LCDML_add(56, LCDML_0_1_7, 5, "OP5", UI_func_OP5); LCDML_add(57, LCDML_0_1_7, 6, "OP6", UI_func_OP6); -LCDML_add(58, LCDML_0, 2, "Effect", NULL); +LCDML_add(58, LCDML_0, 2, "Effects", NULL); LCDML_add(59, LCDML_0_2, 1, "Chorus", NULL); LCDML_add(60, LCDML_0_2_1, 1, "Frequency", UI_func_chorus_frequency); LCDML_add(61, LCDML_0_2_1, 2, "Waveform", UI_func_chorus_waveform); @@ -104,9 +104,9 @@ 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); -LCDML_add(79, LCDML_0_3, 3, "FX", NULL); -LCDML_add(80, LCDML_0_3_3, 1, "Load FX Cfg", UI_func_load_fx); -LCDML_add(81, LCDML_0_3_3, 2, "Save FX Cfg", UI_func_save_fx); +LCDML_add(79, LCDML_0_3, 3, "Effects", NULL); +LCDML_add(80, LCDML_0_3_3, 1, "Load Effects Cfg", UI_func_load_fx); +LCDML_add(81, LCDML_0_3_3, 2, "Save Effects Cfg", UI_func_save_fx); LCDML_add(82, LCDML_0_3, 4, "Voice", NULL); LCDML_add(83, LCDML_0_3_4, 1, "Save Voice", UI_func_save_voice); LCDML_add(84, LCDML_0_3, 5, "MIDI", NULL); diff --git a/UI_2_FX.h b/UI_2_FX.h index 359e9c5..3131675 100644 --- a/UI_2_FX.h +++ b/UI_2_FX.h @@ -31,10 +31,10 @@ LCDML_add(2, LCDML_0_1_1, 1, "Select", UI_func_voice_select); LCDML_add(3, LCDML_0_1_1, 2, "Audio", NULL); LCDML_add(4, LCDML_0_1_1_2, 1, "Voice Level", UI_func_sound_intensity); LCDML_add(5, LCDML_0_1_1_2, 2, "Panorama", UI_func_panorama); -LCDML_add(6, LCDML_0_1_1_2, 3, "Effect Send", NULL); -LCDML_add(7, LCDML_0_1_1_2_3, 1, "Reverb Send", UI_func_reverb_send); -LCDML_add(8, LCDML_0_1_1_2_3, 2, "Chorus Send", UI_func_chorus_send); -LCDML_add(9, LCDML_0_1_1_2_3, 3, "Delay Send", UI_func_delay_send); +LCDML_add(6, LCDML_0_1_1_2, 3, "Effects Send", NULL); +LCDML_add(7, LCDML_0_1_1_2_3, 1, "Chorus Send", UI_func_chorus_send); +LCDML_add(8, LCDML_0_1_1_2_3, 2, "Delay Send", UI_func_delay_send); +LCDML_add(9, LCDML_0_1_1_2_3, 3, "Reverb Send", UI_func_reverb_send); LCDML_add(10, LCDML_0_1_1_2, 4, "Filter", NULL); LCDML_add(11, LCDML_0_1_1_2_4, 1, "Cutoff", UI_func_filter_cutoff); LCDML_add(12, LCDML_0_1_1_2_4, 2, "Resonance", UI_func_filter_resonance); @@ -89,10 +89,10 @@ LCDML_add(60, LCDML_0_1_2, 1, "Select", UI_func_voice_select); LCDML_add(61, LCDML_0_1_2, 2, "Audio", NULL); LCDML_add(62, LCDML_0_1_2_2, 1, "Voice Level", UI_func_sound_intensity); LCDML_add(63, LCDML_0_1_2_2, 2, "Panorama", UI_func_panorama); -LCDML_add(64, LCDML_0_1_2_2, 3, "Effect Send", NULL); -LCDML_add(65, LCDML_0_1_2_2_3, 1, "Reverb Send", UI_func_reverb_send); -LCDML_add(66, LCDML_0_1_2_2_3, 2, "Chorus Send", UI_func_chorus_send); -LCDML_add(67, LCDML_0_1_2_2_3, 3, "Delay Send", UI_func_delay_send); +LCDML_add(64, LCDML_0_1_2_2, 3, "Effects Send", NULL); +LCDML_add(65, LCDML_0_1_2_2_3, 1, "Chorus Send", UI_func_chorus_send); +LCDML_add(66, LCDML_0_1_2_2_3, 2, "Delay Send", UI_func_delay_send); +LCDML_add(67, LCDML_0_1_2_2_3, 3, "Reverb Send", UI_func_reverb_send); LCDML_add(68, LCDML_0_1_2_2, 4, "Filter", NULL); LCDML_add(69, LCDML_0_1_2_2_4, 1, "Cutoff", UI_func_filter_cutoff); LCDML_add(70, LCDML_0_1_2_2_4, 2, "Resonance", UI_func_filter_resonance); @@ -142,7 +142,7 @@ LCDML_add(113, LCDML_0_1_2_7, 3, "OP3", UI_func_OP3); LCDML_add(114, LCDML_0_1_2_7, 4, "OP4", UI_func_OP4); LCDML_add(115, LCDML_0_1_2_7, 5, "OP5", UI_func_OP5); LCDML_add(116, LCDML_0_1_2_7, 6, "OP6", UI_func_OP6); -LCDML_add(117, LCDML_0, 3, "Effect", NULL); +LCDML_add(117, LCDML_0, 3, "Effects", NULL); LCDML_add(118, LCDML_0_3, 1, "Chorus", NULL); LCDML_add(119, LCDML_0_3_1, 1, "Frequency", UI_func_chorus_frequency); LCDML_add(120, LCDML_0_3_1, 2, "Waveform", UI_func_chorus_waveform); @@ -164,8 +164,8 @@ LCDML_add(135, LCDML_0_4, 2, "Voice Config", NULL); LCDML_add(136, LCDML_0_4_2, 1, "Load Voice Cfg", UI_func_load_voiceconfig); LCDML_add(137, LCDML_0_4_2, 2, "Save Voice Cfg", UI_func_save_voiceconfig); LCDML_add(138, LCDML_0_4, 3, "FX", NULL); -LCDML_add(139, LCDML_0_4_3, 1, "Load FX Cfg", UI_func_load_fx); -LCDML_add(140, LCDML_0_4_3, 2, "Save FX Cfg", UI_func_save_fx); +LCDML_add(139, LCDML_0_4_3, 1, "Load Effects Cfg", UI_func_load_fx); +LCDML_add(140, LCDML_0_4_3, 2, "Save Effects Cfg", UI_func_save_fx); LCDML_add(141, LCDML_0_4, 4, "Voice", NULL); LCDML_add(142, LCDML_0_4_4, 1, "Save Voice", UI_func_save_voice); LCDML_add(143, LCDML_0_4, 5, "MIDI", NULL);