From 0e9377b1cae5cf1a2b3933070d61ce17332dd5da Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Sat, 11 Mar 2023 11:30:43 +0100 Subject: [PATCH] Added switching of engines to menu. --- MicroDexed.ino | 4 ++ UI.h | 147 +++++++++++++++++++++++++------------------------ UI.hpp | 59 ++++++++++++++++++++ config.h | 5 ++ 4 files changed, 142 insertions(+), 73 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 68d9040..cbb94d8 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1801,6 +1801,7 @@ void check_configuration_dexed(uint8_t instance_id) { configuration.dexed[instance_id].bank = constrain(configuration.dexed[instance_id].bank, 0, MAX_BANKS - 1); configuration.dexed[instance_id].voice = constrain(configuration.dexed[instance_id].voice, 0, MAX_VOICES - 1); configuration.dexed[instance_id].midi_channel = constrain(configuration.dexed[instance_id].midi_channel, MIDI_CHANNEL_MIN, MIDI_CHANNEL_MAX); + configuration.dexed[instance_id].engine = constrain(configuration.dexed[instance_id].engine, ENGINE_MIN, ENGINE_MAX); configuration.dexed[instance_id].lowest_note = constrain(configuration.dexed[instance_id].lowest_note, INSTANCE_LOWEST_NOTE_MIN, INSTANCE_LOWEST_NOTE_MAX); configuration.dexed[instance_id].highest_note = constrain(configuration.dexed[instance_id].highest_note, INSTANCE_HIGHEST_NOTE_MIN, INSTANCE_HIGHEST_NOTE_MAX); configuration.dexed[instance_id].sound_intensity = constrain(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); @@ -1900,6 +1901,7 @@ void init_configuration(void) { configuration.dexed[instance_id].bank = SYSEXBANK_DEFAULT; configuration.dexed[instance_id].voice = SYSEXSOUND_DEFAULT; configuration.dexed[instance_id].midi_channel = DEFAULT_MIDI_CHANNEL; + configuration.dexed[instance_id].engine = ENGINE_DEFAULT; configuration.dexed[instance_id].lowest_note = INSTANCE_LOWEST_NOTE_MIN; configuration.dexed[instance_id].highest_note = INSTANCE_HIGHEST_NOTE_MAX; configuration.dexed[instance_id].sound_intensity = SOUND_INTENSITY_DEFAULT; @@ -2699,6 +2701,8 @@ void show_configuration(void) { Serial.println(configuration.dexed[instance_id].voice, DEC); Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.dexed[instance_id].midi_channel, DEC); + Serial.print(F(" ENGINE ")); + Serial.println(configuration.dexed[instance_id].engine, DEC); Serial.print(F(" Lowest Note ")); Serial.println(configuration.dexed[instance_id].lowest_note, DEC); Serial.print(F(" Highest Note ")); diff --git a/UI.h b/UI.h index 84406f9..89bc0d2 100644 --- a/UI.h +++ b/UI.h @@ -85,76 +85,77 @@ LCDML_add(51, LCDML_0_1_5, 5, "Mono/Poly", UI_func_mono_poly); LCDML_add(52, LCDML_0_1, 6, "Internal", NULL); LCDML_add(53, LCDML_0_1_6, 1, "Note Refresh", UI_func_note_refresh); LCDML_add(54, LCDML_0_1_6, 2, "Velocity Lvl", UI_func_velocity_level); -LCDML_add(55, LCDML_0_1, 7, "Operator", UI_handle_OP); -LCDML_add(56, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); -LCDML_add(57, LCDML_0, 2, "Drums", NULL); -LCDML_add(58, LCDML_0_2, 1, "Main Volume", UI_func_drum_main_volume); -LCDML_add(59, LCDML_0_2, 2, "Vol Min/Max", UI_func_drum_vol_min_max); -LCDML_add(60, LCDML_0_2, 3, "Panorama", UI_func_drum_pan); -LCDML_add(61, LCDML_0_2, 4, "Reverb Send", UI_func_drum_reverb_send); -LCDML_add(62, LCDML_0_2, 5, "Pitch", UI_func_drum_pitch); -LCDML_add(63, LCDML_0_2, 6, "MIDI Notes", UI_func_drum_midi_note); -LCDML_add(64, LCDML_0_2, 7, "MIDI Channel", UI_func_drum_midi_channel); -LCDML_add(65, LCDML_0, 3, "E-Piano", NULL); -LCDML_add(66, LCDML_0_3, 1, "Voice Level", UI_func_epiano_sound_intensity); -LCDML_add(67, LCDML_0_3, 2, "Panorama", UI_func_epiano_panorama); -LCDML_add(68, LCDML_0_3, 3, "Sound", NULL); -LCDML_add(69, LCDML_0_3_3, 1, "Decay", UI_func_epiano_decay); -LCDML_add(70, LCDML_0_3_3, 2, "Release", UI_func_epiano_release); // uint8_t release; -LCDML_add(71, LCDML_0_3_3, 3, "Hardness", UI_func_epiano_hardness); // uint8_t hardness; -LCDML_add(72, LCDML_0_3_3, 4, "Treble", UI_func_epiano_treble); // uint8_t treble; -LCDML_add(73, LCDML_0_3_3, 5, "Stereo", UI_func_epiano_stereo); // uint8_t stereo; -LCDML_add(74, LCDML_0_3_3, 6, "Tune", UI_func_epiano_tune); // uint8_t tune; -LCDML_add(75, LCDML_0_3_3, 7, "Detune", UI_func_epiano_detune); // uint8_t detune; -LCDML_add(76, LCDML_0_3, 4, "Effects", NULL); -LCDML_add(77, LCDML_0_3_4, 1, "Overdrive", UI_func_epiano_overdrive); // uint8_t overdrive; -LCDML_add(78, LCDML_0_3_4, 2, "Tremolo", NULL); -LCDML_add(79, LCDML_0_3_4_2, 1, "Width", UI_func_epiano_pan_tremolo); // uint8_t pan_tremolo; -LCDML_add(80, LCDML_0_3_4_2, 2, "LFO", UI_func_epiano_pan_lfo); // uint8_t pan_lfo; -LCDML_add(81, LCDML_0_3_4, 3, "Chorus", NULL); -LCDML_add(82, LCDML_0_3_4_3, 1, "Frequency", UI_func_epiano_chorus_frequency); -LCDML_add(83, LCDML_0_3_4_3, 2, "Waveform", UI_func_epiano_chorus_waveform); -LCDML_add(84, LCDML_0_3_4_3, 3, "Depth", UI_func_epiano_chorus_depth); -LCDML_add(85, LCDML_0_3_4_3, 4, "Level", UI_func_epiano_chorus_level); -LCDML_add(86, LCDML_0_3_4, 4, "Reverb Send", UI_func_epiano_reverb_send); -LCDML_add(87, LCDML_0_3, 6, "MIDI", NULL); -LCDML_add(88, LCDML_0_3_6, 1, "MIDI Channel", UI_func_epiano_midi_channel); // uint8_t midi_channel; -LCDML_add(89, LCDML_0_3_6, 2, "Lowest Note", UI_func_epiano_lowest_note); // uint8_t lowest_note; -LCDML_add(90, LCDML_0_3_6, 3, "Highest Note", UI_func_epiano_highest_note); // uint8_t highest_note; -LCDML_add(91, LCDML_0_3, 7, "Setup", NULL); -LCDML_add(92, LCDML_0_3_7, 4, "Transpose", UI_func_epiano_transpose); // uint8_t transpose; -LCDML_add(93, LCDML_0_3_7, 1, "Polyphony", UI_func_epiano_polyphony); // uint8_t polyphony; -LCDML_add(94, LCDML_0_3_7, 2, "Vel. Sense", UI_func_epiano_velocity_sense); // uint8_t velocity_sense; -LCDML_add(95, LCDML_0, 4, "Master Effects", NULL); -LCDML_add(96, LCDML_0_4, 1, "Reverb", NULL); -LCDML_add(97, LCDML_0_4_1, 1, "Roomsize", UI_func_reverb_roomsize); -LCDML_add(98, LCDML_0_4_1, 2, "Lowpass", UI_func_reverb_lowpass); -LCDML_add(99, LCDML_0_4_1, 3, "Lodamp", UI_func_reverb_lodamp); -LCDML_add(100, LCDML_0_4_1, 4, "Hidamp", UI_func_reverb_hidamp); -LCDML_add(101, LCDML_0_4_1, 5, "Diffusion", UI_func_reverb_diffusion); -LCDML_add(102, LCDML_0_4_1, 6, "Level", UI_func_reverb_level); -LCDML_add(103, LCDML_0_4_1, 7, "Reverb Send", UI_func_reverb_send); -LCDML_add(104, LCDML_0_4, 2, "EQ", NULL); -LCDML_add(105, LCDML_0_4_2, 1, "Low-Cut", UI_func_eq_1); -LCDML_add(106, LCDML_0_4_2, 2, "110Hz", UI_func_eq_2); -LCDML_add(107, LCDML_0_4_2, 3, "220Hz", UI_func_eq_3); -LCDML_add(108, LCDML_0_4_2, 4, "1000Hz", UI_func_eq_4); -LCDML_add(109, LCDML_0_4_2, 5, "2000Hz", UI_func_eq_5); -LCDML_add(110, LCDML_0_4_2, 6, "7000Hz", UI_func_eq_6); -LCDML_add(111, LCDML_0_4_2, 7, "High-Cut", UI_func_eq_7); -LCDML_add(112, LCDML_0, 5, "Load/Save", NULL); -LCDML_add(113, LCDML_0_5, 1, "Load Perf.", UI_func_load_performance); -LCDML_add(114, LCDML_0_5, 2, "Save Perf.", UI_func_save_performance); -LCDML_add(115, LCDML_0_5, 3, "Name Perf.", UI_func_set_performance_name); -LCDML_add(116, LCDML_0_5, 4, "MIDI", NULL); -LCDML_add(117, LCDML_0_5_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); -LCDML_add(118, LCDML_0_5_4, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); -LCDML_add(119, LCDML_0_5_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); -LCDML_add(120, LCDML_0, 6, "System", NULL); -LCDML_add(121, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); -LCDML_add(122, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); -LCDML_add(123, LCDML_0_6, 3, "Favorites", UI_func_favorites); -LCDML_add(124, LCDML_0_6, 4, "Startup", UI_func_startup); -LCDML_add(125, LCDML_0, 7, "Info", UI_func_information); -LCDML_addAdvanced(126, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); -#define _LCDML_DISP_cnt 126 +LCDML_add(55, LCDML_0_1_6, 3, "Engine", UI_func_engine); +LCDML_add(56, LCDML_0_1, 7, "Operator", UI_handle_OP); +LCDML_add(57, LCDML_0_1, 8, "Save Voice", UI_func_save_voice); +LCDML_add(58, LCDML_0, 2, "Drums", NULL); +LCDML_add(59, LCDML_0_2, 1, "Main Volume", UI_func_drum_main_volume); +LCDML_add(60, LCDML_0_2, 2, "Vol Min/Max", UI_func_drum_vol_min_max); +LCDML_add(61, LCDML_0_2, 3, "Panorama", UI_func_drum_pan); +LCDML_add(62, LCDML_0_2, 4, "Reverb Send", UI_func_drum_reverb_send); +LCDML_add(63, LCDML_0_2, 5, "Pitch", UI_func_drum_pitch); +LCDML_add(64, LCDML_0_2, 6, "MIDI Notes", UI_func_drum_midi_note); +LCDML_add(65, LCDML_0_2, 7, "MIDI Channel", UI_func_drum_midi_channel); +LCDML_add(66, LCDML_0, 3, "E-Piano", NULL); +LCDML_add(67, LCDML_0_3, 1, "Voice Level", UI_func_epiano_sound_intensity); +LCDML_add(68, LCDML_0_3, 2, "Panorama", UI_func_epiano_panorama); +LCDML_add(69, LCDML_0_3, 3, "Sound", NULL); +LCDML_add(70, LCDML_0_3_3, 1, "Decay", UI_func_epiano_decay); +LCDML_add(71, LCDML_0_3_3, 2, "Release", UI_func_epiano_release); // uint8_t release; +LCDML_add(72, LCDML_0_3_3, 3, "Hardness", UI_func_epiano_hardness); // uint8_t hardness; +LCDML_add(73, LCDML_0_3_3, 4, "Treble", UI_func_epiano_treble); // uint8_t treble; +LCDML_add(74, LCDML_0_3_3, 5, "Stereo", UI_func_epiano_stereo); // uint8_t stereo; +LCDML_add(75, LCDML_0_3_3, 6, "Tune", UI_func_epiano_tune); // uint8_t tune; +LCDML_add(76, LCDML_0_3_3, 7, "Detune", UI_func_epiano_detune); // uint8_t detune; +LCDML_add(77, LCDML_0_3, 4, "Effects", NULL); +LCDML_add(78, LCDML_0_3_4, 1, "Overdrive", UI_func_epiano_overdrive); // uint8_t overdrive; +LCDML_add(79, LCDML_0_3_4, 2, "Tremolo", NULL); +LCDML_add(80, LCDML_0_3_4_2, 1, "Width", UI_func_epiano_pan_tremolo); // uint8_t pan_tremolo; +LCDML_add(81, LCDML_0_3_4_2, 2, "LFO", UI_func_epiano_pan_lfo); // uint8_t pan_lfo; +LCDML_add(82, LCDML_0_3_4, 3, "Chorus", NULL); +LCDML_add(83, LCDML_0_3_4_3, 1, "Frequency", UI_func_epiano_chorus_frequency); +LCDML_add(84, LCDML_0_3_4_3, 2, "Waveform", UI_func_epiano_chorus_waveform); +LCDML_add(85, LCDML_0_3_4_3, 3, "Depth", UI_func_epiano_chorus_depth); +LCDML_add(86, LCDML_0_3_4_3, 4, "Level", UI_func_epiano_chorus_level); +LCDML_add(87, LCDML_0_3_4, 4, "Reverb Send", UI_func_epiano_reverb_send); +LCDML_add(88, LCDML_0_3, 6, "MIDI", NULL); +LCDML_add(89, LCDML_0_3_6, 1, "MIDI Channel", UI_func_epiano_midi_channel); // uint8_t midi_channel; +LCDML_add(90, LCDML_0_3_6, 2, "Lowest Note", UI_func_epiano_lowest_note); // uint8_t lowest_note; +LCDML_add(91, LCDML_0_3_6, 3, "Highest Note", UI_func_epiano_highest_note); // uint8_t highest_note; +LCDML_add(92, LCDML_0_3, 7, "Setup", NULL); +LCDML_add(93, LCDML_0_3_7, 4, "Transpose", UI_func_epiano_transpose); // uint8_t transpose; +LCDML_add(94, LCDML_0_3_7, 1, "Polyphony", UI_func_epiano_polyphony); // uint8_t polyphony; +LCDML_add(95, LCDML_0_3_7, 2, "Vel. Sense", UI_func_epiano_velocity_sense); // uint8_t velocity_sense; +LCDML_add(96, LCDML_0, 4, "Master Effects", NULL); +LCDML_add(97, LCDML_0_4, 1, "Reverb", NULL); +LCDML_add(98, LCDML_0_4_1, 1, "Roomsize", UI_func_reverb_roomsize); +LCDML_add(99, LCDML_0_4_1, 2, "Lowpass", UI_func_reverb_lowpass); +LCDML_add(100, LCDML_0_4_1, 3, "Lodamp", UI_func_reverb_lodamp); +LCDML_add(101, LCDML_0_4_1, 4, "Hidamp", UI_func_reverb_hidamp); +LCDML_add(102, LCDML_0_4_1, 5, "Diffusion", UI_func_reverb_diffusion); +LCDML_add(103, LCDML_0_4_1, 6, "Level", UI_func_reverb_level); +LCDML_add(104, LCDML_0_4_1, 7, "Reverb Send", UI_func_reverb_send); +LCDML_add(105, LCDML_0_4, 2, "EQ", NULL); +LCDML_add(106, LCDML_0_4_2, 1, "Low-Cut", UI_func_eq_1); +LCDML_add(107, LCDML_0_4_2, 2, "110Hz", UI_func_eq_2); +LCDML_add(108, LCDML_0_4_2, 3, "220Hz", UI_func_eq_3); +LCDML_add(109, LCDML_0_4_2, 4, "1000Hz", UI_func_eq_4); +LCDML_add(110, LCDML_0_4_2, 5, "2000Hz", UI_func_eq_5); +LCDML_add(111, LCDML_0_4_2, 6, "7000Hz", UI_func_eq_6); +LCDML_add(112, LCDML_0_4_2, 7, "High-Cut", UI_func_eq_7); +LCDML_add(113, LCDML_0, 5, "Load/Save", NULL); +LCDML_add(114, LCDML_0_5, 1, "Load Perf.", UI_func_load_performance); +LCDML_add(115, LCDML_0_5, 2, "Save Perf.", UI_func_save_performance); +LCDML_add(116, LCDML_0_5, 3, "Name Perf.", UI_func_set_performance_name); +LCDML_add(117, LCDML_0_5, 4, "MIDI", NULL); +LCDML_add(118, LCDML_0_5_4, 1, "MIDI Recv Bank", UI_func_sysex_receive_bank); +LCDML_add(119, LCDML_0_5_4, 2, "MIDI Snd Bank", UI_func_sysex_send_bank); +LCDML_add(120, LCDML_0_5_4, 3, "MIDI Snd Voice", UI_func_sysex_send_voice); +LCDML_add(121, LCDML_0, 6, "System", NULL); +LCDML_add(122, LCDML_0_6, 1, "Stereo/Mono", UI_func_stereo_mono); +LCDML_add(123, LCDML_0_6, 2, "MIDI Soft THRU", UI_func_midi_soft_thru); +LCDML_add(124, LCDML_0_6, 3, "Favorites", UI_func_favorites); +LCDML_add(125, LCDML_0_6, 4, "Startup", UI_func_startup); +LCDML_add(126, LCDML_0, 7, "Info", UI_func_information); +LCDML_addAdvanced(127, LCDML_0, 8, COND_hide, "Volume", UI_func_volume, 0, _LCDML_TYPE_default); +#define _LCDML_DISP_cnt 127 diff --git a/UI.hpp b/UI.hpp index 2d69d25..6c46a62 100644 --- a/UI.hpp +++ b/UI.hpp @@ -282,6 +282,7 @@ void UI_func_save_performance(uint8_t param); void UI_func_save_voice(uint8_t param); void UI_func_midi_soft_thru(uint8_t param); void UI_func_velocity_level(uint8_t param); +void UI_func_engine(uint8_t param); void UI_func_voice_select(uint8_t param); void UI_func_sysex_send_voice(uint8_t param); void UI_func_sysex_receive_bank(uint8_t param); @@ -4857,6 +4858,64 @@ void UI_func_velocity_level(uint8_t param) { } } +void UI_func_engine(uint8_t param) { + if (LCDML.FUNC_setup()) // ****** SETUP ********* + { + encoderDir[ENC_R].reset(); + + display.clear(); + display.show(0, 0, 16, "Engine"); + switch (configuration.dexed[selected_instance_id].engine) { + case 0: + display.show(1, 0, 16, "[Modern]"); + break; + case 1: + display.show(1, 0, 16, "[Mark I]"); + break; + case 2: + display.show(1, 0, 16, "[OPL]"); + break; + } + + lcd_active_instance_number(selected_instance_id); + UI_update_instance_icons(); + } + + if (LCDML.FUNC_loop()) // ****** LOOP ********* + { + if ((LCDML.BT_checkDown() && encoderDir[ENC_R].Down()) || (LCDML.BT_checkUp() && encoderDir[ENC_R].Up())) { + if (LCDML.BT_checkDown()) + configuration.dexed[selected_instance_id].engine = (configuration.dexed[selected_instance_id].engine + 1) % 3; + else if (LCDML.BT_checkUp()) + configuration.dexed[selected_instance_id].engine = (configuration.dexed[selected_instance_id].engine + 1) % 3; + } +#if NUM_DEXED > 1 + else if (LCDML.BT_checkEnter()) { + selected_instance_id = !selected_instance_id; + lcd_active_instance_number(selected_instance_id); + UI_update_instance_icons(); + } +#endif + + switch (configuration.dexed[selected_instance_id].engine) { + case 0: + display.show(1, 0, 16, "[Modern]"); + break; + case 1: + display.show(1, 0, 16, "[Mark I]"); + break; + case 2: + display.show(1, 0, 16, "[OPL]"); + break; + } + } + + if (LCDML.FUNC_close()) // ****** STABLE END ********* + { + encoderDir[ENC_R].reset(); + } +} + void UI_update_instance_icons() { display.setCursor(14, 0); display.write(0); //Icon for first instance diff --git a/config.h b/config.h index 6a509ae..4f26754 100644 --- a/config.h +++ b/config.h @@ -523,6 +523,10 @@ #define VELOCITY_LEVEL_MAX 127 #define VELOCITY_LEVEL_DEFAULT 100 +#define ENGINE_MIN 0 +#define ENGINE_MAX 2 +#define ENGINE_DEFAULT 0 + #define PERFORMANCE_NUM_MIN 0 #define PERFORMANCE_NUM_MAX 99 #define PERFORMANCE_NUM_DEFAULT 0 @@ -724,6 +728,7 @@ typedef struct dexed_s { uint8_t portamento_time; uint8_t op_enabled; uint8_t midi_channel; + uint8_t engine; } dexed_t; typedef struct fx_s {