Fixing pan in stereo/mono mode.

pull/32/head
Holger Wirtz 5 years ago
parent 2e6d8ace0d
commit 0ed0d7cbd0
  1. 19
      MicroDexed.ino
  2. 20
      UI.hpp

@ -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 mosi_pins[] = { SDCARD_TEENSY_MOSI_PIN, SDCARD_AUDIO_MOSI_PIN };
const uint8_t sck_pins[] = { SDCARD_TEENSY_SCK_PIN, SDCARD_AUDIO_SCK_PIN }; const uint8_t sck_pins[] = { SDCARD_TEENSY_SCK_PIN, SDCARD_AUDIO_SCK_PIN };
char version_string[LCD_cols + 1]; char version_string[LCD_cols + 1];
int8_t config_pan[NUM_DEXED];
#if defined(USE_FX) #if defined(USE_FX)
// Allocate the delay lines for chorus // Allocate the delay lines for chorus
@ -511,6 +512,7 @@ void setup()
// PANORAMA // PANORAMA
mono2stereo[instance_id]->panorama(mapfloat(configuration.dexed[instance_id].pan, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0)); 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) #if defined(USE_FX)
@ -1268,35 +1270,44 @@ void set_volume(uint8_t v, uint8_t m)
{ {
case 0: // stereo case 0: // stereo
stereo2mono.stereo(true); 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 modchorus_inverter.gain(-1.0); // stereo mode
break; break;
case 1: // mono both case 1: // mono both
stereo2mono.stereo(false); stereo2mono.stereo(false);
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) 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; configuration.dexed[instance_id].pan = PANORAMA_DEFAULT;
} }
modchorus_inverter.gain(1.0); // stereo mode modchorus_inverter.gain(1.0);
break; break;
case 2: // mono right case 2: // mono right
volume_l.gain(0.0); volume_l.gain(0.0);
stereo2mono.stereo(false); stereo2mono.stereo(false);
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) 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; 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)); 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; break;
case 3: // mono left case 3: // mono left
volume_r.gain(0.0); volume_r.gain(0.0);
stereo2mono.stereo(false); stereo2mono.stereo(false);
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) 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; 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)); 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; break;
} }
} }
@ -1539,6 +1550,8 @@ void eeprom_update(void)
autostore = 0; autostore = 0;
else else
{ {
if (config_pan[instance_id] >= 0)
configuration.dexed[instance_id].pan = config_pan[instance_id];
eeprom_update_flag = false; eeprom_update_flag = false;
configuration.checksum = crc32((byte*)&configuration + 4, sizeof(configuration) - 4); configuration.checksum = crc32((byte*)&configuration + 4, sizeof(configuration) - 4);
EEPROM.put(EEPROM_START_ADDRESS, configuration); EEPROM.put(EEPROM_START_ADDRESS, configuration);

@ -1622,6 +1622,26 @@ void UI_func_stereo_mono(uint8_t param)
// setup function // setup function
lcd.setCursor(0, 0); lcd.setCursor(0, 0);
lcd.print(F("Stereo/Mono")); 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 ********* if (LCDML.FUNC_loop()) // ****** LOOP *********

Loading…
Cancel
Save