From 8abae42e61869b08fa855d4cfd1d574b51195215 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 1 Nov 2019 14:45:57 +0100 Subject: [PATCH] Several changes for multi-instance handling. --- MicroDexed.ino | 48 +++++++++++++++++++++++++++++++----------------- UI.hpp | 6 +++--- config.h | 3 +++ 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index e6804d1..124d7d5 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1092,27 +1092,44 @@ void initial_values_from_eeprom(void) Serial.print(F(" - mismatch -> initializing EEPROM!")); #endif configuration.checksum = 0xffff; - configuration.bank[0] = SYSEXBANK_DEFAULT; - configuration.voice[0] = SYSEXSOUND_DEFAULT; + configuration.vol = VOLUME_DEFAULT; - configuration.pan[0] = PANORAMA_DEFAULT; configuration.mono = MONO_DEFAULT; - configuration.midi_channel[0] = DEFAULT_MIDI_CHANNEL; + configuration.reverb_roomsize = REVERB_ROOMSIZE_DEFAULT; configuration.reverb_damping = REVERB_DAMPING_DEFAULT; - configuration.reverb_level[0] = REVERB_LEVEL_DEFAULT; configuration.chorus_frequency = CHORUS_FREQUENCY_DEFAULT; configuration.chorus_waveform = CHORUS_WAVEFORM_DEFAULT; configuration.chorus_depth = CHORUS_DEPTH_DEFAULT; - configuration.chorus_level[0] = CHORUS_LEVEL_DEFAULT; configuration.delay_time = DELAY_TIME_DEFAULT; configuration.delay_feedback = DELAY_FEEDBACK_DEFAULT; - configuration.delay_level[0] = DELAY_LEVEL_DEFAULT; - configuration.filter_cutoff[0] = FILTER_CUTOFF_DEFAULT; - configuration.filter_resonance[0] = FILTER_RESONANCE_DEFAULT; - configuration.loudness[0] = LOUDNESS_DEFAULT; - configuration.polyphony[0] = POLYPHONY_DEFAULT; - configuration.engine[0] = ENGINE_DEFAULT; + for (uint8_t i = 0; i < NUM_DEXED; i++) + { + configuration.midi_channel[i] = DEFAULT_MIDI_CHANNEL; + configuration.bank[i] = SYSEXBANK_DEFAULT; + configuration.voice[i] = SYSEXSOUND_DEFAULT; + configuration.pan[i] = PANORAMA_DEFAULT; + configuration.reverb_level[i] = REVERB_LEVEL_DEFAULT; + configuration.chorus_level[i] = CHORUS_LEVEL_DEFAULT; + configuration.delay_level[i] = DELAY_LEVEL_DEFAULT; + configuration.filter_cutoff[i] = FILTER_CUTOFF_DEFAULT; + configuration.filter_resonance[i] = FILTER_RESONANCE_DEFAULT; + configuration.loudness[i] = LOUDNESS_DEFAULT; + configuration.polyphony[i] = POLYPHONY_DEFAULT; + configuration.engine[i] = ENGINE_DEFAULT; + configuration.monopoly[i] = MONOPOLY_DEFAULT; + configuration.pb_range[i] = PB_RANGE_DEFAULT; + configuration.pb_step[i] = PB_STEP_DEFAULT; + configuration.mw_range[i] = MW_RANGE_DEFAULT; + configuration.mw_assign[i] = MW_ASSIGN_DEFAULT; + configuration.fc_range[i] = FC_RANGE_DEFAULT; + configuration.fc_assign[i] = FC_ASSIGN_DEFAULT; + configuration.bc_range[i] = BC_RANGE_DEFAULT; + configuration.bc_assign[i] = BC_ASSIGN_DEFAULT; + configuration.at_range[i] = AT_RANGE_DEFAULT; + configuration.at_assign[i] = AT_ASSIGN_DEFAULT; + configuration.op_enabled[i] = OP_ENABLED_DEFAULT; + } eeprom_update(); } else @@ -1204,24 +1221,20 @@ void show_configuration(void) Serial.println(); Serial.println(F("CONFIGURATION:")); Serial.print(F("Checksum 0x")); Serial.println(configuration.checksum, HEX); - Serial.print(F("Volume ")); Serial.println(configuration.vol, DEC); - Serial.print(F("Panorama ")); Serial.println(configuration.pan[0], DEC); Serial.print(F("Mono ")); Serial.println(configuration.mono, DEC); Serial.print(F("Reverb Roomsize ")); Serial.println(configuration.reverb_roomsize, DEC); Serial.print(F("Reverb Damping ")); Serial.println(configuration.reverb_damping, DEC); Serial.print(F("Chorus Frequency ")); Serial.println(configuration.chorus_frequency, DEC); Serial.print(F("Chorus Waveform ")); Serial.println(configuration.chorus_waveform, DEC); Serial.print(F("Chorus Depth ")); Serial.println(configuration.chorus_depth, DEC); - Serial.print(F("Chorus Level ")); Serial.println(configuration.chorus_level[0], DEC); Serial.print(F("Delay Time ")); Serial.println(configuration.delay_time, DEC); Serial.print(F("Delay Feedback ")); Serial.println(configuration.delay_feedback, DEC); - Serial.print(F("MIDI-Channel ")); Serial.println(configuration.midi_channel[0], DEC); - for (uint8_t i = 0; i < NUM_DEXED; i++) { Serial.print(F("DEXED Instance ")); Serial.println(i, DEC); + Serial.print(F(" MIDI-Channel ")); Serial.println(configuration.midi_channel[i], DEC); Serial.print(F(" Bank ")); Serial.println(configuration.bank[i], DEC); Serial.print(F(" Voice ")); Serial.println(configuration.voice[i], DEC); Serial.print(F(" Panorama ")); Serial.println(configuration.pan[i], DEC); @@ -1244,6 +1257,7 @@ void show_configuration(void) Serial.print(F(" Breathctrl Assign ")); Serial.println(configuration.bc_assign[i], DEC); Serial.print(F(" Aftertouch Range ")); Serial.println(configuration.at_range[i], DEC); Serial.print(F(" Aftertouch Assign ")); Serial.println(configuration.at_assign[i], DEC); + Serial.print(F(" OP Enabled ")); Serial.println(configuration.op_enabled[i], DEC); } Serial.println(); } diff --git a/UI.hpp b/UI.hpp index 6c47ff7..cc6c754 100644 --- a/UI.hpp +++ b/UI.hpp @@ -289,9 +289,9 @@ LCDML_add(23, LCDML_0_1_2, 14, "Aftertouch", NULL); LCDML_add(24, LCDML_0_1_2_14, 1, "AT Range", UI_function_not_implemented); LCDML_add(25, LCDML_0_1_2_14, 2, "AT Assign", UI_function_not_implemented); LCDML_add(26, LCDML_0_1_2, 15, "Portamento", NULL); -LCDML_add(27, LCDML_0_1_2_15, 1, "Port. Mode", UI_function_not_enabled); -LCDML_add(28, LCDML_0_1_2_15, 2, "Port. Gliss", UI_function_not_enabled); -LCDML_add(29, LCDML_0_1_2_15, 3, "Port. Time", UI_function_not_enabled); +LCDML_add(27, LCDML_0_1_2_15, 1, "Port. Mode", UI_function_not_implemented); +LCDML_add(28, LCDML_0_1_2_15, 2, "Port. Gliss", UI_function_not_implemented); +LCDML_add(29, LCDML_0_1_2_15, 3, "Port. Time", UI_function_not_implemented); LCDML_add(30, LCDML_0_1_2, 16, "Operator", NULL); LCDML_add(31, LCDML_0_1_2_16, 1, "OP1", UI_function_not_implemented); LCDML_add(32, LCDML_0_1_2_16, 2, "OP2", UI_function_not_implemented); diff --git a/config.h b/config.h index 776634c..ca3d15f 100644 --- a/config.h +++ b/config.h @@ -386,6 +386,8 @@ 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 PORTAMENTO_MODE_MIN 0 #define PORTAMENTO_MODE_MAX 1 #define PORTAMENTO_MODE_DEFAULT 0 // 0: Retain, 1: Follow @@ -433,6 +435,7 @@ struct config_t { uint8_t bc_assign[NUM_DEXED]; uint8_t at_range[NUM_DEXED]; uint8_t at_assign[NUM_DEXED]; + uint8_t op_enabled[NUM_DEXED]; }; inline float mapfloat(float val, float in_min, float in_max, float out_min, float out_max)