diff --git a/UI.hpp b/UI.hpp index be258bf..11e45b8 100644 --- a/UI.hpp +++ b/UI.hpp @@ -148,7 +148,7 @@ void UI_func_information(uint8_t param); void UI_func_voice_selection(uint8_t param); void UI_func_volume(uint8_t param); void UI_function_not_enabled(void); -void UI_function_not_implemented(void); +void UI_function_not_implemented(uint8_t param); void lcd_display_int(int16_t var, uint8_t size, bool zeros, bool brackets, bool sign); void lcd_display_float(float var, uint8_t size_number, uint8_t size_fraction, bool zeros, bool brackets, bool sign); @@ -160,88 +160,97 @@ LCDMenuLib2 LCDML(LCDML_0, _LCDML_DISP_rows, _LCDML_DISP_cols, lcdml_menu_displa LCDML_add(0, LCDML_0, 1, "Setup", NULL); LCDML_add(1, LCDML_0_1, 1, "Instances", UI_function_not_implemented); LCDML_add(2, LCDML_0_1, 2, "Instance 1", NULL); -LCDML_add(3, LCDML_0_1_2, 1, "Mono/Poly 1", UI_function_not_implemented); -LCDML_add(4, LCDML_0_1_2, 2, "Pitchbend 1", NULL); -LCDML_add(5, LCDML_0_1_2_2, 1, "PB Range 1", UI_function_not_implemented); -LCDML_add(6, LCDML_0_1_2_2, 2, "PB Step 1", UI_function_not_implemented); -LCDML_add(7, LCDML_0_1_2, 3, "Mod Wheel 1", NULL); -LCDML_add(8, LCDML_0_1_2_3, 1, "MW Range 1", UI_function_not_implemented); -LCDML_add(9, LCDML_0_1_2_3, 2, "MW Assign 1", UI_function_not_implemented); -LCDML_add(10, LCDML_0_1_2, 4, "Foot Ctrl 1", NULL); -LCDML_add(11, LCDML_0_1_2_4, 1, "FC Range 1", UI_function_not_implemented); -LCDML_add(12, LCDML_0_1_2_4, 2, "FC Assign 1", UI_function_not_implemented); -LCDML_add(13, LCDML_0_1_2, 5, "Breath Ctrl 1", NULL); -LCDML_add(14, LCDML_0_1_2_5, 1, "BC Range 1", UI_function_not_implemented); -LCDML_add(15, LCDML_0_1_2_5, 2, "BC Assign 1", UI_function_not_implemented); -LCDML_add(16, LCDML_0_1_2, 6, "Aftertouch 1", NULL); -LCDML_add(17, LCDML_0_1_2_6, 1, "AT Range 1", UI_function_not_implemented); -LCDML_add(18, LCDML_0_1_2_6, 2, "AT Assign 1", UI_function_not_implemented); -LCDML_add(19, LCDML_0_1_2, 7, "Portamento 1", NULL); -LCDML_add(20, LCDML_0_1_2_7, 1, "Port. Mode 1", UI_function_not_enabled); -LCDML_add(21, LCDML_0_1_2_7, 2, "Port. Gliss 1", UI_function_not_enabled); -LCDML_add(22, LCDML_0_1_2_7, 3, "Port. Time 1", UI_function_not_enabled); -LCDML_add(23, LCDML_0_1_2, 8, "Operator 1", NULL); -LCDML_add(24, LCDML_0_1_2_8, 1, "OP1 1", UI_function_not_implemented); -LCDML_add(25, LCDML_0_1_2_8, 2, "OP2 1", UI_function_not_implemented); -LCDML_add(26, LCDML_0_1_2_8, 3, "OP3 1", UI_function_not_implemented); -LCDML_add(27, LCDML_0_1_2_8, 4, "OP4 1", UI_function_not_implemented); -LCDML_add(28, LCDML_0_1_2_8, 5, "OP5 1", UI_function_not_implemented); -LCDML_add(29, LCDML_0_1_2_8, 6, "OP6 1", UI_function_not_implemented); -LCDML_add(30, LCDML_0_1, 3, "Instance 2", NULL); -LCDML_add(31, LCDML_0_1_3, 1, "Mono/Poly 2", UI_function_not_implemented); -LCDML_add(32, LCDML_0_1_3, 2, "Pitchbend 2", NULL); -LCDML_add(33, LCDML_0_1_3_2, 1, "PB Range 2", UI_function_not_implemented); -LCDML_add(34, LCDML_0_1_3_2, 2, "PB Step 2", UI_function_not_implemented); -LCDML_add(35, LCDML_0_1_3, 3, "Mod Wheel 2", NULL); -LCDML_add(36, LCDML_0_1_3_3, 1, "MW Range 2", UI_function_not_implemented); -LCDML_add(37, LCDML_0_1_3_3, 2, "MW Assign 2", UI_function_not_implemented); -LCDML_add(38, LCDML_0_1_3, 4, "Foot Ctrl 2", NULL); -LCDML_add(39, LCDML_0_1_3_4, 1, "FC Range 2", UI_function_not_implemented); -LCDML_add(40, LCDML_0_1_3_4, 2, "FC Assign 2", UI_function_not_implemented); -LCDML_add(41, LCDML_0_1_3, 5, "Breat Ctrl 2", NULL); -LCDML_add(42, LCDML_0_1_3_5, 1, "BC Range 2", UI_function_not_implemented); -LCDML_add(43, LCDML_0_1_3_5, 2, "BC Assign 2", UI_function_not_implemented); -LCDML_add(44, LCDML_0_1_3, 6, "Aftertouch 2", NULL); -LCDML_add(45, LCDML_0_1_3_6, 1, "AT Range 2", UI_function_not_implemented); -LCDML_add(46, LCDML_0_1_3_6, 2, "AT Assign 2", UI_function_not_implemented); -LCDML_add(47, LCDML_0_1_3, 7, "Portamento 2", NULL); -LCDML_add(48, LCDML_0_1_3_7, 1, "Port. Mode 2", UI_function_not_enabled); -LCDML_add(49, LCDML_0_1_3_7, 2, "Port. Gliss 2", UI_function_not_enabled); -LCDML_add(50, LCDML_0_1_3_7, 3, "Port. Time 2", UI_function_not_enabled); -LCDML_add(51, LCDML_0_1_3, 8, "Operator 2", NULL); -LCDML_add(52, LCDML_0_1_3_8, 1, "OP1 2", UI_function_not_implemented); -LCDML_add(53, LCDML_0_1_3_8, 2, "OP2 2", UI_function_not_implemented); -LCDML_add(54, LCDML_0_1_3_8, 3, "OP3 2", UI_function_not_implemented); -LCDML_add(55, LCDML_0_1_3_8, 4, "OP4 2", UI_function_not_implemented); -LCDML_add(56, LCDML_0_1_3_8, 5, "OP5 2", UI_function_not_implemented); -LCDML_add(57, LCDML_0_1_3_8, 6, "OP6 2", UI_function_not_implemented); -LCDML_add(58, LCDML_0, 2, "Effect", NULL); -LCDML_add(59, LCDML_0_2, 1, "Reverb", NULL); -LCDML_add(60, LCDML_0_2_1, 1, "Roomsize", UI_func_reverb_roomsize); -LCDML_add(61, LCDML_0_2_1, 2, "Damping", UI_func_reverb_damping); -LCDML_add(62, LCDML_0_2_1, 3, "Level", UI_func_reverb_level); -LCDML_add(63, LCDML_0_2, 2, "Chorus", NULL); -LCDML_add(64, LCDML_0_2_2, 1, "Frequency", UI_func_chorus_frequency); -LCDML_add(65, LCDML_0_2_2, 2, "Waveform", UI_func_chorus_waveform); -LCDML_add(66, LCDML_0_2_2, 3, "Depth", UI_func_chorus_depth); -LCDML_add(67, LCDML_0_2_2, 4, "Level", UI_func_chorus_level); -LCDML_add(68, LCDML_0_2, 3, "Delay", NULL); -LCDML_add(69, LCDML_0_2_3, 1, "Time", UI_func_delay_time); -LCDML_add(70, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback); -LCDML_add(71, LCDML_0_2_3, 3, "Level", UI_func_delay_level); -LCDML_add(72, LCDML_0_2, 4, "Filter", NULL); -LCDML_add(73, LCDML_0_2_4, 1, "Cutoff", UI_func_filter_cutoff); -LCDML_add(74, LCDML_0_2_4, 2, "Resonance", UI_func_filter_resonance); -LCDML_add(75, LCDML_0, 3, "Store", NULL); -LCDML_add(76, LCDML_0, 4, "System", NULL); -LCDML_add(77, LCDML_0_4, 1, "MIDI Channel", UI_func_midi_channel); -LCDML_add(78, LCDML_0_4, 2, "Loudness", UI_func_loudness); -LCDML_add(79, LCDML_0_4, 3, "Panorama", UI_func_panorama); -LCDML_add(80, LCDML_0_4, 4, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(81, LCDML_0_4, 5, "Polyphony", UI_func_polyphony); -LCDML_add(82, LCDML_0_4, 6, "Engine", UI_func_engine); -LCDML_add(83, LCDML_0, 5, "Info", UI_func_information); -#define _LCDML_DISP_cnt 83 +LCDML_add(3, LCDML_0_1_2, 1, "MIDI Channel 1", UI_func_midi_channel); +LCDML_add(4, LCDML_0_1_2, 2, "Loudness 1", UI_func_loudness); +LCDML_add(5, LCDML_0_1_2, 3, "Reverb Level 1", UI_func_reverb_level); +LCDML_add(6, LCDML_0_1_2, 4, "Chorus Level 1", UI_func_chorus_level); +LCDML_add(7, LCDML_0_1_2, 5, "Delay Level 1", UI_func_delay_level); +LCDML_add(8, LCDML_0_1_2, 6, "Panorama 1", UI_func_panorama); +LCDML_add(9, LCDML_0_1_2, 7, "Polyphony 1", UI_func_polyphony); +LCDML_add(10, LCDML_0_1_2, 8, "Engine 1", UI_func_engine); +LCDML_add(11, LCDML_0_1_2, 9, "Mono/Poly 1", UI_function_not_implemented); +LCDML_add(12, LCDML_0_1_2, 10, "Pitchbend 1", NULL); +LCDML_add(13, LCDML_0_1_2_7, 1, "PB Range 1", UI_function_not_implemented); +LCDML_add(14, LCDML_0_1_2_7, 2, "PB Step 1", UI_function_not_implemented); +LCDML_add(15, LCDML_0_1_2, 11, "Mod Wheel 1", NULL); +LCDML_add(16, LCDML_0_1_2_8, 1, "MW Range 1", UI_function_not_implemented); +LCDML_add(17, LCDML_0_1_2_8, 2, "MW Assign 1", UI_function_not_implemented); +LCDML_add(18, LCDML_0_1_2, 12, "Foot Ctrl 1", NULL); +LCDML_add(19, LCDML_0_1_2_9, 1, "FC Range 1", UI_function_not_implemented); +LCDML_add(20, LCDML_0_1_2_9, 2, "FC Assign 1", UI_function_not_implemented); +LCDML_add(21, LCDML_0_1_2, 13, "Breath Ctrl 1", NULL); +LCDML_add(22, LCDML_0_1_2_10, 1, "BC Range 1", UI_function_not_implemented); +LCDML_add(23, LCDML_0_1_2_10, 2, "BC Assign 1", UI_function_not_implemented); +LCDML_add(24, LCDML_0_1_2, 14, "Aftertouch 1", NULL); +LCDML_add(25, LCDML_0_1_2_11, 1, "AT Range 1", UI_function_not_implemented); +LCDML_add(26, LCDML_0_1_2_11, 2, "AT Assign 1", UI_function_not_implemented); +LCDML_add(27, LCDML_0_1_2, 15, "Portamento 1", NULL); +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(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); +LCDML_add(41, LCDML_0_1_3, 3, "Reverb Level 2", UI_func_reverb_level); +LCDML_add(42, LCDML_0_1_3, 4, "Chorus Level 2", UI_func_chorus_level); +LCDML_add(43, LCDML_0_1_3, 5, "Delay Level 2", UI_func_delay_level); +LCDML_add(44, LCDML_0_1_3, 6, "Panorama 2", UI_func_panorama); +LCDML_add(45, LCDML_0_1_3, 7, "Polyphony 2", UI_func_polyphony); +LCDML_add(46, LCDML_0_1_3, 8, "Engine 2", UI_func_engine); +LCDML_add(47, LCDML_0_1_3, 9, "Mono/Poly 2", UI_function_not_implemented); +LCDML_add(48, LCDML_0_1_3, 10, "Pitchbend 2", NULL); +LCDML_add(49, LCDML_0_1_3_7, 1, "PB Range 2", UI_function_not_implemented); +LCDML_add(50, LCDML_0_1_3_7, 2, "PB Step 2", UI_function_not_implemented); +LCDML_add(51, LCDML_0_1_3, 11, "Mod Wheel 2", NULL); +LCDML_add(52, LCDML_0_1_3_8, 1, "MW Range 2", UI_function_not_implemented); +LCDML_add(53, LCDML_0_1_3_8, 2, "MW Assign 2", UI_function_not_implemented); +LCDML_add(54, LCDML_0_1_3, 12, "Foot Ctrl 2", NULL); +LCDML_add(55, LCDML_0_1_3_9, 1, "FC Range 2", UI_function_not_implemented); +LCDML_add(56, LCDML_0_1_3_9, 2, "FC Assign 2", UI_function_not_implemented); +LCDML_add(57, LCDML_0_1_3, 13, "Breat Ctrl 2", NULL); +LCDML_add(58, LCDML_0_1_3_10, 1, "BC Range 2", UI_function_not_implemented); +LCDML_add(59, LCDML_0_1_3_10, 2, "BC Assign 2", UI_function_not_implemented); +LCDML_add(60, LCDML_0_1_3, 14, "Aftertouch 2", NULL); +LCDML_add(61, LCDML_0_1_3_11, 1, "AT Range 2", UI_function_not_implemented); +LCDML_add(62, LCDML_0_1_3_11, 2, "AT Assign 2", UI_function_not_implemented); +LCDML_add(63, LCDML_0_1_3, 15, "Portamento 2", NULL); +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(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); +LCDML_add(77, LCDML_0_2_1, 2, "Damping", UI_func_reverb_damping); +LCDML_add(78, LCDML_0_2, 2, "Chorus", NULL); +LCDML_add(79, LCDML_0_2_2, 1, "Frequency", UI_func_chorus_frequency); +LCDML_add(80, LCDML_0_2_2, 2, "Waveform", UI_func_chorus_waveform); +LCDML_add(81, LCDML_0_2_2, 3, "Depth", UI_func_chorus_depth); +LCDML_add(82, LCDML_0_2, 3, "Delay", NULL); +LCDML_add(83, LCDML_0_2_3, 1, "Time", UI_func_delay_time); +LCDML_add(84, LCDML_0_2_3, 2, "Feedback", UI_func_delay_feedback); +LCDML_add(85, LCDML_0_2, 4, "Filter", NULL); +LCDML_add(86, LCDML_0_2_4, 1, "Cutoff", UI_func_filter_cutoff); +LCDML_add(87, LCDML_0_2_4, 2, "Resonance", UI_func_filter_resonance); +LCDML_add(88, LCDML_0, 3, "Store", NULL); +LCDML_add(89, LCDML_0, 4, "System", NULL); +LCDML_add(90, LCDML_0_4, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(91, LCDML_0, 5, "Info", UI_func_information); +#define _LCDML_DISP_cnt 91 +#define MENU_ID_OF_INSTANCE_2 38 // create menu LCDML_createMenu(_LCDML_DISP_cnt); @@ -467,6 +476,11 @@ void lcdml_menu_control(void) ************************************************************************************/ void encoder_right_up(void) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + switch (menu_state) { case MENU_EDIT: @@ -481,14 +495,14 @@ void encoder_right_up(void) switch (menu_voice) { case MENU_VOICE_BANK: - if (configuration.bank[0] < MAX_BANKS) + if (configuration.bank[instance_id] < MAX_BANKS) { - configuration.bank[0]++; + configuration.bank[instance_id]++; #ifdef DISPLAY_LCD_SPI change_disp_sd(false); #endif - load_sysex(configuration.bank[0], configuration.voice[0]); - get_voice_names_from_bank(configuration.bank[0]); + load_sysex(configuration.bank[instance_id], configuration.voice[instance_id]); + get_voice_names_from_bank(configuration.bank[instance_id]); #ifdef DISPLAY_LCD_SPI change_disp_sd(true); #endif @@ -496,21 +510,21 @@ void encoder_right_up(void) } break; case MENU_VOICE_SOUND: - if (configuration.voice[0] < MAX_VOICES - 1) - configuration.voice[0]++; + if (configuration.voice[instance_id] < MAX_VOICES - 1) + configuration.voice[instance_id]++; else { - if (configuration.bank[0] < MAX_BANKS) + if (configuration.bank[instance_id] < MAX_BANKS) { - configuration.bank[0]++; - configuration.voice[0] = 0; + configuration.bank[instance_id]++; + configuration.voice[instance_id] = 0; } } #ifdef DISPLAY_LCD_SPI change_disp_sd(false); #endif - load_sysex(configuration.bank[0], configuration.voice[0]); - get_voice_names_from_bank(configuration.bank[0]); + load_sysex(configuration.bank[instance_id], configuration.voice[instance_id]); + get_voice_names_from_bank(configuration.bank[instance_id]); #ifdef DISPLAY_LCD_SPI change_disp_sd(true); #endif @@ -524,6 +538,11 @@ void encoder_right_up(void) void encoder_right_down(void) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + switch (menu_state) { case MENU_EDIT: @@ -538,15 +557,15 @@ void encoder_right_down(void) switch (menu_voice) { case MENU_VOICE_BANK: - if (configuration.bank[0] > 0) + if (configuration.bank[instance_id] > 0) { - configuration.bank[0]--; + configuration.bank[instance_id]--; #ifdef DISPLAY_LCD_SPI change_disp_sd(false); #endif - load_sysex(configuration.bank[0], configuration.voice[0]); - get_voice_names_from_bank(configuration.bank[0]); + load_sysex(configuration.bank[instance_id], configuration.voice[instance_id]); + get_voice_names_from_bank(configuration.bank[instance_id]); #ifdef DISPLAY_LCD_SPI change_disp_sd(true); #endif @@ -554,21 +573,21 @@ void encoder_right_down(void) } break; case MENU_VOICE_SOUND: - if (configuration.voice[0] > 0) - configuration.voice[0]--; + if (configuration.voice[instance_id] > 0) + configuration.voice[instance_id]--; else { - if (configuration.bank[0] > 0) + if (configuration.bank[instance_id] > 0) { - configuration.bank[0]--; - configuration.voice[0] = 31; + configuration.bank[instance_id]--; + configuration.voice[instance_id] = 31; } } #ifdef DISPLAY_LCD_SPI change_disp_sd(false); #endif - load_sysex(configuration.bank[0], configuration.voice[0]); - get_voice_names_from_bank(configuration.bank[0]); + load_sysex(configuration.bank[instance_id], configuration.voice[instance_id]); + get_voice_names_from_bank(configuration.bank[instance_id]); #ifdef DISPLAY_LCD_SPI change_disp_sd(true); #endif @@ -930,6 +949,11 @@ void UI_func_reverb_damping(uint8_t param) void UI_func_reverb_level(uint8_t param) { #ifdef USE_REVERB + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -945,25 +969,25 @@ void UI_func_reverb_level(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.reverb_level[0] < REVERB_LEVEL_MAX) + if (configuration.reverb_level[instance_id] < REVERB_LEVEL_MAX) { - configuration.reverb_level[0]++; + configuration.reverb_level[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.reverb_level[0] > REVERB_LEVEL_MIN) + if (configuration.reverb_level[instance_id] > REVERB_LEVEL_MIN) { - configuration.reverb_level[0]--; + configuration.reverb_level[instance_id]--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.reverb_level[0], 3, true, true, false); + lcd_display_int(configuration.reverb_level[instance_id], 3, true, true, false); - master_mixer_r.gain(1, configuration.reverb_level[0] / 100.0); - master_mixer_l.gain(1, configuration.reverb_level[0] / 100.0); + master_mixer_r.gain(1, configuration.reverb_level[instance_id] / 100.0); + master_mixer_l.gain(1, configuration.reverb_level[instance_id] / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1120,6 +1144,11 @@ void UI_func_chorus_depth(uint8_t param) void UI_func_chorus_level(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1135,24 +1164,24 @@ void UI_func_chorus_level(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.chorus_level[0] < CHORUS_LEVEL_MAX) + if (configuration.chorus_level[instance_id] < CHORUS_LEVEL_MAX) { - configuration.chorus_level[0]++; + configuration.chorus_level[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.chorus_level[0] > CHORUS_LEVEL_MIN) + if (configuration.chorus_level[instance_id] > CHORUS_LEVEL_MIN) { - configuration.chorus_level[0]--; + configuration.chorus_level[instance_id]--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.chorus_level[0], 3, true, true, false); + lcd_display_int(configuration.chorus_level[instance_id], 3, true, true, false); - master_mixer_r.gain(3, configuration.chorus_level[0] / 100.0); - master_mixer_l.gain(3, configuration.chorus_level[0] / 100.0); + master_mixer_r.gain(3, configuration.chorus_level[instance_id] / 100.0); + master_mixer_l.gain(3, configuration.chorus_level[instance_id] / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1252,6 +1281,11 @@ void UI_func_delay_feedback(uint8_t param) void UI_func_delay_level(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1267,24 +1301,24 @@ void UI_func_delay_level(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.delay_level[0] < DELAY_LEVEL_MAX) + if (configuration.delay_level[instance_id] < DELAY_LEVEL_MAX) { - configuration.delay_level[0]++; + configuration.delay_level[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.delay_level[0] > DELAY_LEVEL_MIN) + if (configuration.delay_level[instance_id] > DELAY_LEVEL_MIN) { - configuration.delay_level[0]--; + configuration.delay_level[instance_id]--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.delay_level[0], 3, true, true, false); + lcd_display_int(configuration.delay_level[instance_id], 3, true, true, false); - master_mixer_r.gain(2, configuration.delay_level[0] / 100.0); - master_mixer_l.gain(2, configuration.delay_level[0] / 100.0); + master_mixer_r.gain(2, configuration.delay_level[instance_id] / 100.0); + master_mixer_l.gain(2, configuration.delay_level[instance_id] / 100.0); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1296,6 +1330,11 @@ void UI_func_delay_level(uint8_t param) void UI_func_filter_cutoff(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1311,21 +1350,21 @@ void UI_func_filter_cutoff(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.filter_cutoff[0] < FILTER_CUTOFF_MAX) + if (configuration.filter_cutoff[instance_id] < FILTER_CUTOFF_MAX) { - configuration.filter_cutoff[0]++; + configuration.filter_cutoff[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.filter_cutoff[0] > FILTER_CUTOFF_MIN) + if (configuration.filter_cutoff[instance_id] > FILTER_CUTOFF_MIN) { - configuration.filter_cutoff[0]--; + configuration.filter_cutoff[instance_id]--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.filter_cutoff[0], 3, true, true, false); + lcd_display_int(configuration.filter_cutoff[instance_id], 3, true, true, false); for (uint8_t i = 0; i < NUM_DEXED; i++) { @@ -1342,6 +1381,11 @@ void UI_func_filter_cutoff(uint8_t param) void UI_func_filter_resonance(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1357,21 +1401,21 @@ void UI_func_filter_resonance(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.filter_resonance[0] < FILTER_RESONANCE_MAX) + if (configuration.filter_resonance[instance_id] < FILTER_RESONANCE_MAX) { - configuration.filter_resonance[0]++; + configuration.filter_resonance[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.filter_resonance[0] > FILTER_RESONANCE_MIN) + if (configuration.filter_resonance[instance_id] > FILTER_RESONANCE_MIN) { - configuration.filter_resonance[0]--; + configuration.filter_resonance[instance_id]--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.filter_resonance[0], 3, true, true, false); + lcd_display_int(configuration.filter_resonance[instance_id], 3, true, true, false); for (uint8_t i = 0; i < NUM_DEXED; i++) { @@ -1388,6 +1432,11 @@ void UI_func_filter_resonance(uint8_t param) void UI_func_midi_channel(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1403,27 +1452,27 @@ void UI_func_midi_channel(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.midi_channel[0] < MIDI_CHANNEL_MAX) + if (configuration.midi_channel[instance_id] < MIDI_CHANNEL_MAX) { - configuration.midi_channel[0]++; + configuration.midi_channel[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.midi_channel[0] > MIDI_CHANNEL_MIN) + if (configuration.midi_channel[instance_id] > MIDI_CHANNEL_MIN) { - configuration.midi_channel[0]--; + configuration.midi_channel[instance_id]--; } } lcd.setCursor(0, 1); - if (configuration.midi_channel[0] == 0) + if (configuration.midi_channel[instance_id] == 0) { lcd.print(F("[OMNI]")); } else { - lcd_display_int(configuration.midi_channel[0], 4, false, true, false); + lcd_display_int(configuration.midi_channel[instance_id], 4, false, true, false); } } @@ -1436,6 +1485,11 @@ void UI_func_midi_channel(uint8_t param) void UI_func_loudness(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1451,25 +1505,25 @@ void UI_func_loudness(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.loudness[0] < LOUDNESS_MAX) + if (configuration.loudness[instance_id] < LOUDNESS_MAX) { - configuration.loudness[0]++; + configuration.loudness[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.loudness[0] > LOUDNESS_MIN) + if (configuration.loudness[instance_id] > LOUDNESS_MIN) { - configuration.loudness[0]--; + configuration.loudness[instance_id]--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.loudness[0], 3, true, true, false); + lcd_display_int(configuration.loudness[instance_id], 3, true, true, false); for (uint8_t i = 0; i < NUM_DEXED; i++) { - MicroDexed[i]->fx.Gain = configuration.loudness[0] / 100.0; + MicroDexed[i]->fx.Gain = configuration.loudness[instance_id] / 100.0; } } @@ -1482,6 +1536,11 @@ void UI_func_loudness(uint8_t param) void UI_func_panorama(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1502,25 +1561,25 @@ void UI_func_panorama(uint8_t param) } else if (LCDML.BT_checkDown() && configuration.mono == 0) { - if (configuration.pan[0] < PANORAMA_MAX) + if (configuration.pan[instance_id] < PANORAMA_MAX) { - configuration.pan[0]++; + configuration.pan[instance_id]++; } } else if (LCDML.BT_checkUp() && configuration.mono == 0) { - if (configuration.pan[0] > PANORAMA_MIN) + if (configuration.pan[instance_id] > PANORAMA_MIN) { - configuration.pan[0]--; + configuration.pan[instance_id]--; } } if (configuration.mono == 0) { lcd.setCursor(0, 1); - lcd_display_int(configuration.pan[0], 2, false, true, true); + lcd_display_int(configuration.pan[instance_id], 2, false, true, true); - set_volume(configuration.vol, configuration.pan[0], configuration.mono); + set_volume(configuration.vol, configuration.pan[instance_id], configuration.mono); } } @@ -1533,6 +1592,11 @@ void UI_func_panorama(uint8_t param) void UI_func_stereo_mono(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1580,7 +1644,7 @@ void UI_func_stereo_mono(uint8_t param) stereomono1.stereo(false); break; } - set_volume(configuration.vol, configuration.pan[0], configuration.mono); + set_volume(configuration.vol, configuration.pan[instance_id], configuration.mono); } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1592,6 +1656,11 @@ void UI_func_stereo_mono(uint8_t param) void UI_func_polyphony(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1607,25 +1676,25 @@ void UI_func_polyphony(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.polyphony[0] < POLYPHONY_MAX) + if (configuration.polyphony[instance_id] < POLYPHONY_MAX) { - configuration.polyphony[0]++; + configuration.polyphony[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.polyphony[0] > POLYPHONY_MIN) + if (configuration.polyphony[instance_id] > POLYPHONY_MIN) { - configuration.polyphony[0]--; + configuration.polyphony[instance_id]--; } } lcd.setCursor(0, 1); - lcd_display_int(configuration.polyphony[0], 2, false, true, false); + lcd_display_int(configuration.polyphony[instance_id], 2, false, true, false); for (uint8_t i = 0; i < NUM_DEXED; i++) { - MicroDexed[i]->setMaxNotes(configuration.polyphony[0]); + MicroDexed[i]->setMaxNotes(configuration.polyphony[instance_id]); } } @@ -1638,6 +1707,11 @@ void UI_func_polyphony(uint8_t param) void UI_func_engine(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + if (LCDML.FUNC_setup()) // ****** SETUP ********* { // setup function @@ -1653,21 +1727,21 @@ void UI_func_engine(uint8_t param) } else if (LCDML.BT_checkDown()) { - if (configuration.engine[0] < ENGINE_MAX) + if (configuration.engine[instance_id] < ENGINE_MAX) { - configuration.engine[0]++; + configuration.engine[instance_id]++; } } else if (LCDML.BT_checkUp()) { - if (configuration.engine[0] > ENGINE_MIN) + if (configuration.engine[instance_id] > ENGINE_MIN) { - configuration.engine[0]--; + configuration.engine[instance_id]--; } } lcd.setCursor(0, 1); - switch (configuration.engine[0]) + switch (configuration.engine[instance_id]) { case 0: lcd.print(F("[MODERN]")); @@ -1682,7 +1756,7 @@ void UI_func_engine(uint8_t param) for (uint8_t i = 0; i < NUM_DEXED; i++) { - MicroDexed[i]->setEngineType(configuration.engine[0]); + MicroDexed[i]->setEngineType(configuration.engine[instance_id]); } } @@ -1722,23 +1796,28 @@ void UI_func_information(uint8_t param) void UI_func_voice_selection(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + #ifdef DEBUG Serial.println(F("UI_func_voice_selection()")); #endif menu_state = MENU_VOICE; - strip_extension(bank_names[configuration.bank[0]], bank_name); + strip_extension(bank_names[configuration.bank[instance_id]], bank_name); //LCDML.DISP_clear(); // display bank and voice number - lcd.show(0, 0, 2, configuration.bank[0]); - lcd.show(1, 0, 2, configuration.voice[0] + 1); + lcd.show(0, 0, 2, configuration.bank[instance_id]); + lcd.show(1, 0, 2, configuration.voice[instance_id] + 1); // display names lcd.show(0, 4, 10, bank_name); - lcd.show(1, 4, 10, voice_names[configuration.voice[0]]); + lcd.show(1, 4, 10, voice_names[configuration.voice[instance_id]]); // display selected Dexed instance if (selected_dexed_instance == 1) @@ -1784,6 +1863,11 @@ void UI_func_voice_selection(uint8_t param) void UI_func_volume(uint8_t param) { + uint8_t instance_id = 0; + + if (LCDML.FUNC_getID() < MENU_ID_OF_INSTANCE_2) + instance_id = 1; + #ifdef DEBUG Serial.println(F("UI_func_volume()")); #endif @@ -1807,7 +1891,7 @@ void UI_func_volume(uint8_t param) else lcd.print(F(" ")); } - set_volume(configuration.vol, configuration.pan[0], configuration.mono); + set_volume(configuration.vol, configuration.pan[instance_id], configuration.mono); eeprom_write(); } @@ -1836,7 +1920,7 @@ void UI_function_not_enabled(void) } } -void UI_function_not_implemented(void) +void UI_function_not_implemented(uint8_t param) { if (LCDML.FUNC_setup()) // ****** SETUP ********* {