diff --git a/MicroDexed.ino b/MicroDexed.ino index 49551e6..490a7a9 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -224,6 +224,7 @@ const uint8_t cs_pins[] = { SDCARD_TEENSY_CS_PIN, SDCARD_AUDIO_CS_PIN }; const uint8_t mosi_pins[] = { SDCARD_TEENSY_MOSI_PIN, SDCARD_AUDIO_MOSI_PIN }; const uint8_t sck_pins[] = { SDCARD_TEENSY_SCK_PIN, SDCARD_AUDIO_SCK_PIN }; char version_string[LCD_cols + 1]; +int8_t config_pan[NUM_DEXED]; #if defined(USE_FX) // Allocate the delay lines for chorus @@ -511,6 +512,7 @@ void setup() // PANORAMA mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); + config_pan[instance_id] = -1; } #if defined(USE_FX) @@ -617,7 +619,7 @@ void loop() // check encoder ENCODER[ENC_L].update(); ENCODER[ENC_R].update(); - + // CONTROL-RATE-EVENT-HANDLING if (control_rate > CONTROL_RATE_MS) { @@ -1268,35 +1270,44 @@ void set_volume(uint8_t v, uint8_t m) { case 0: // stereo stereo2mono.stereo(true); + for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) + { + if (config_pan[instance_id] >= 0) + configuration.dexed[instance_id].pan = config_pan[instance_id]; + mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); + } modchorus_inverter.gain(-1.0); // stereo mode break; case 1: // mono both stereo2mono.stereo(false); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + config_pan[instance_id] = configuration.dexed[instance_id].pan; configuration.dexed[instance_id].pan = PANORAMA_DEFAULT; } - modchorus_inverter.gain(1.0); // stereo mode + modchorus_inverter.gain(1.0); break; case 2: // mono right volume_l.gain(0.0); stereo2mono.stereo(false); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + config_pan[instance_id] = configuration.dexed[instance_id].pan; configuration.dexed[instance_id].pan = 0.0; mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); } - modchorus_inverter.gain(1.0); // stereo mode + modchorus_inverter.gain(1.0); break; case 3: // mono left volume_r.gain(0.0); stereo2mono.stereo(false); for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) { + config_pan[instance_id] = configuration.dexed[instance_id].pan; configuration.dexed[instance_id].pan = 1.0; mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); } - modchorus_inverter.gain(1.0); // stereo mode + modchorus_inverter.gain(1.0); break; } } @@ -1539,6 +1550,8 @@ void eeprom_update(void) autostore = 0; else { + if (config_pan[instance_id] >= 0) + configuration.dexed[instance_id].pan = config_pan[instance_id]; eeprom_update_flag = false; configuration.checksum = crc32((byte*)&configuration + 4, sizeof(configuration) - 4); EEPROM.put(EEPROM_START_ADDRESS, configuration); diff --git a/UI.hpp b/UI.hpp index f365d2c..56ebe59 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1622,6 +1622,26 @@ void UI_func_stereo_mono(uint8_t param) // setup function lcd.setCursor(0, 0); lcd.print(F("Stereo/Mono")); + lcd.setCursor(0, 1); + switch (configuration.mono) + { + case 0: + lcd.print(F("[STEREO]")); + stereo2mono.stereo(true); + break; + case 1: + lcd.print(F("[MONO ]")); + stereo2mono.stereo(false); + break; + case 2: + lcd.print(F("[MONO-R]")); + stereo2mono.stereo(false); + break; + case 3: + lcd.print(F("[MONO-L]")); + stereo2mono.stereo(false); + break; + } } if (LCDML.FUNC_loop()) // ****** LOOP *********