From c1ca4861b51a38ccd3a3ed37619f1567f7bf765e Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 8 Nov 2019 11:24:08 +0100 Subject: [PATCH] Implemented UI functions for enabling/disabling operators. --- UI.hpp | 146 ++++++++++++++++++++++++++++++++++++++++++++++++------- config.h | 4 +- 2 files changed, 131 insertions(+), 19 deletions(-) diff --git a/UI.hpp b/UI.hpp index 0a0ec8d..5ae21a1 100644 --- a/UI.hpp +++ b/UI.hpp @@ -158,6 +158,13 @@ void UI_func_bc_range(uint8_t param); void UI_func_bc_assign(uint8_t param); void UI_func_at_range(uint8_t param); void UI_func_at_assign(uint8_t param); +void UI_func_OP1(uint8_t param); +void UI_func_OP2(uint8_t param); +void UI_func_OP3(uint8_t param); +void UI_func_OP4(uint8_t param); +void UI_func_OP5(uint8_t param); +void UI_func_OP6(uint8_t param); +void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id); void UI_func_information(uint8_t param); void UI_func_voice_selection(uint8_t param); void UI_func_volume(uint8_t param); @@ -204,12 +211,12 @@ LCDML_add(28, LCDML_0_1_2_12, 1, "Port. Mode 1", UI_function_not_enabled); LCDML_add(29, LCDML_0_1_2_12, 2, "Port. Gliss 1", UI_function_not_enabled); LCDML_add(30, LCDML_0_1_2_12, 3, "Port. Time 1", UI_function_not_enabled); LCDML_add(31, LCDML_0_1_2, 16, "Operator 1", NULL); -LCDML_add(32, LCDML_0_1_2_13, 1, "OP1 1", UI_function_not_implemented); -LCDML_add(33, LCDML_0_1_2_13, 2, "OP2 1", UI_function_not_implemented); -LCDML_add(34, LCDML_0_1_2_13, 3, "OP3 1", UI_function_not_implemented); -LCDML_add(35, LCDML_0_1_2_13, 4, "OP4 1", UI_function_not_implemented); -LCDML_add(36, LCDML_0_1_2_13, 5, "OP5 1", UI_function_not_implemented); -LCDML_add(37, LCDML_0_1_2_13, 6, "OP6 1", UI_function_not_implemented); +LCDML_add(32, LCDML_0_1_2_13, 1, "OP1 1", UI_func_OP1); +LCDML_add(33, LCDML_0_1_2_13, 2, "OP2 1", UI_func_OP2); +LCDML_add(34, LCDML_0_1_2_13, 3, "OP3 1", UI_func_OP3); +LCDML_add(35, LCDML_0_1_2_13, 4, "OP4 1", UI_func_OP4); +LCDML_add(36, LCDML_0_1_2_13, 5, "OP5 1", UI_func_OP5); +LCDML_add(37, LCDML_0_1_2_13, 6, "OP6 1", UI_func_OP6); LCDML_add(38, LCDML_0_1, 3, "Instance 2", NULL); LCDML_add(39, LCDML_0_1_3, 1, "MIDI Channel 2", UI_func_midi_channel); LCDML_add(40, LCDML_0_1_3, 2, "Loudness 2", UI_func_loudness); @@ -240,12 +247,12 @@ LCDML_add(64, LCDML_0_1_3_12, 1, "Port. Mode 2", UI_function_not_enabled); LCDML_add(65, LCDML_0_1_3_12, 2, "Port. Gliss 2", UI_function_not_enabled); LCDML_add(66, LCDML_0_1_3_12, 3, "Port. Time 2", UI_function_not_enabled); LCDML_add(67, LCDML_0_1_3, 16, "Operator 2", NULL); -LCDML_add(68, LCDML_0_1_3_13, 1, "OP1 2", UI_function_not_implemented); -LCDML_add(69, LCDML_0_1_3_13, 2, "OP2 2", UI_function_not_implemented); -LCDML_add(70, LCDML_0_1_3_13, 3, "OP3 2", UI_function_not_implemented); -LCDML_add(71, LCDML_0_1_3_13, 4, "OP4 2", UI_function_not_implemented); -LCDML_add(72, LCDML_0_1_3_13, 5, "OP5 2", UI_function_not_implemented); -LCDML_add(73, LCDML_0_1_3_13, 6, "OP6 2", UI_function_not_implemented); +LCDML_add(68, LCDML_0_1_3_13, 1, "OP1 2", UI_func_OP1); +LCDML_add(69, LCDML_0_1_3_13, 2, "OP2 2", UI_func_OP2); +LCDML_add(70, LCDML_0_1_3_13, 3, "OP3 2", UI_func_OP3); +LCDML_add(71, LCDML_0_1_3_13, 4, "OP4 2", UI_func_OP4); +LCDML_add(72, LCDML_0_1_3_13, 5, "OP5 2", UI_func_OP5); +LCDML_add(73, LCDML_0_1_3_13, 6, "OP6 2", UI_func_OP6); LCDML_add(74, LCDML_0, 2, "Effect", NULL); LCDML_add(75, LCDML_0_2, 1, "Reverb", NULL); LCDML_add(76, LCDML_0_2_1, 1, "Roomsize", UI_func_reverb_roomsize); @@ -297,12 +304,12 @@ LCDML_add(26, LCDML_0_1_15, 1, "Port. Mode", UI_function_not_implemented); LCDML_add(27, LCDML_0_1_15, 2, "Port. Gliss", UI_function_not_implemented); LCDML_add(28, LCDML_0_1_15, 3, "Port. Time", UI_function_not_implemented); LCDML_add(29, LCDML_0_1, 16, "Operator", NULL); -LCDML_add(30, LCDML_0_1_16, 1, "OP1", UI_function_not_implemented); -LCDML_add(31, LCDML_0_1_16, 2, "OP2", UI_function_not_implemented); -LCDML_add(32, LCDML_0_1_16, 3, "OP3", UI_function_not_implemented); -LCDML_add(33, LCDML_0_1_16, 4, "OP4", UI_function_not_implemented); -LCDML_add(34, LCDML_0_1_16, 5, "OP5", UI_function_not_implemented); -LCDML_add(35, LCDML_0_1_16, 6, "OP6", UI_function_not_implemented); +LCDML_add(30, LCDML_0_1_16, 1, "OP1", UI_func_OP1); +LCDML_add(31, LCDML_0_1_16, 2, "OP2", UI_func_OP2); +LCDML_add(32, LCDML_0_1_16, 3, "OP3", UI_func_OP3); +LCDML_add(33, LCDML_0_1_16, 4, "OP4", UI_func_OP4); +LCDML_add(34, LCDML_0_1_16, 5, "OP5", UI_func_OP5); +LCDML_add(35, LCDML_0_1_16, 6, "OP6", UI_func_OP6); LCDML_add(36, LCDML_0, 2, "Effect", NULL); LCDML_add(37, LCDML_0_2, 1, "Reverb", NULL); LCDML_add(38, LCDML_0_2_1, 1, "Roomsize", UI_func_reverb_roomsize); @@ -2483,6 +2490,109 @@ void UI_func_at_assign(uint8_t param) } } +void UI_func_OP1(uint8_t param) +{ + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + + UI_handle_OP(param, 0, instance_id); +} + +void UI_func_OP2(uint8_t param) +{ + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + + UI_handle_OP(param, 0, instance_id); +} + +void UI_func_OP3(uint8_t param) +{ + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + + UI_handle_OP(param, 2, instance_id); +} + +void UI_func_OP4(uint8_t param) +{ + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + + UI_handle_OP(param, 3, instance_id); +} + +void UI_func_OP5(uint8_t param) +{ + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + + UI_handle_OP(param, 4, instance_id); +} + +void UI_func_OP6(uint8_t param) +{ + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() > MENU_ID_OF_INSTANCE_2) + instance_id = 1; + + UI_handle_OP(param, 5, instance_id); +} + +void UI_handle_OP(uint8_t param, uint8_t op, uint8_t instance_id) +{ + bool state = bitRead(configuration.dexed[instance_id].op_enabled, op); + + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + // setup function + lcd.setCursor(0, 0); + lcd.print(F("Operator ")); + lcd.print(op + 1); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if (LCDML.BT_checkEnter()) + { + LCDML.FUNC_goBackToMenu(); + } + else if (LCDML.BT_checkUp() && state == true) + bitClear(configuration.dexed[instance_id].op_enabled, op); + else if (LCDML.BT_checkDown() && state == false) + bitSet(configuration.dexed[instance_id].op_enabled, op); + } + + lcd.setCursor(0, 1); + if (state == true) + { + lcd.print(F("[ENABLED ]")); + } + else + { + lcd.print(F("[DISABLED]")); + } + MicroDexed[instance_id]->setOPs(configuration.dexed[instance_id].op_enabled); + MicroDexed[instance_id]->doRefreshVoice(); + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + // you can here reset some global vars or do nothing + eeprom_write(); + } +} + void UI_func_information(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* diff --git a/config.h b/config.h index 6c31157..2457409 100644 --- a/config.h +++ b/config.h @@ -386,7 +386,9 @@ enum { DEXED, REVERB, DELAY, CHORUS }; #define AT_ASSIGN_MAX 7 #define AT_ASSIGN_DEFAULT 0 // Bitmapped: 0: Pitch, 1: Amp, 2: Bias -#define OP_ENABLED_DEFAULT 0x3f +#define OP_ENABLED_MIN 0 +#define OP_ENABLED_MAX 0x3f +#define OP_ENABLED_DEFAULT OP_ENABLED_MAX #define PORTAMENTO_MODE_MIN 0 #define PORTAMENTO_MODE_MAX 1