Another fix for stereo/mono implementation.

pull/32/head
Holger Wirtz 5 years ago
parent 0ed0d7cbd0
commit 281e435bfa
  1. 25
      MicroDexed.ino

@ -224,7 +224,6 @@ 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
@ -512,7 +511,6 @@ 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)
@ -1271,42 +1269,27 @@ 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++) 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)); 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++)
{ mono2stereo[instance_id]->panorama(mapfloat(PANORAMA_DEFAULT, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
config_pan[instance_id] = configuration.dexed[instance_id].pan;
configuration.dexed[instance_id].pan = PANORAMA_DEFAULT;
}
modchorus_inverter.gain(1.0); 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++)
{ mono2stereo[instance_id]->panorama(mapfloat(PANORAMA_MAX, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
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); 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++)
{ mono2stereo[instance_id]->panorama(mapfloat(PANORAMA_MIN, PANORAMA_MIN, PANORAMA_MAX, -1.0, 1.0));
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); modchorus_inverter.gain(1.0);
break; break;
} }
@ -1550,8 +1533,6 @@ 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);

Loading…
Cancel
Save