Using cross-fade for chorus mix-in to avoid digital saturation.

pull/32/head
Holger Wirtz 5 years ago
parent aa8ed261d7
commit cfa0462e4e
  1. 16
      MicroDexed.ino
  2. 4
      UI.hpp

@ -1354,8 +1354,8 @@ void initial_values_from_eeprom(bool init)
MicroDexed[instance_id]->doRefreshVoice(); MicroDexed[instance_id]->doRefreshVoice();
#if defined(USE_FX) #if defined(USE_FX)
chorus_mixer[instance_id]->gain(0, 1.0); chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true));
chorus_mixer[instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true));
delay_mixer[instance_id]->gain(0, 1.0); delay_mixer[instance_id]->gain(0, 1.0);
delay_mixer[instance_id]->gain(1, mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0)); delay_mixer[instance_id]->gain(1, mapfloat(configuration.fx.delay_level[instance_id], DELAY_LEVEL_MIN, DELAY_LEVEL_MAX, 0.0, 1.0));
delay_fb_mixer[instance_id]->gain(0, 1.0); delay_fb_mixer[instance_id]->gain(0, 1.0);
@ -1654,8 +1654,8 @@ void set_fx_params(void)
for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++) for (uint8_t instance_id = 0; instance_id < NUM_DEXED; instance_id++)
{ {
// CHORUS // CHORUS
chorus_mixer[instance_id]->gain(0, 1.0); chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true));
chorus_mixer[instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true));
switch (configuration.fx.chorus_waveform[instance_id]) switch (configuration.fx.chorus_waveform[instance_id])
{ {
case 0: case 0:
@ -1738,6 +1738,14 @@ void _softRestart(void)
SCB_AIRCR = 0x05FA0004; //write value for restart SCB_AIRCR = 0x05FA0004; //write value for restart
} }
float pseudo_log_curve(float value, bool type)
{
if (type == true)
return (_pseudo_log * arm_sin_f32(value));
else
return (_pseudo_log * arm_cos_f32(value));
}
uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc
{ {
const uint32_t crc_table[16] = const uint32_t crc_table[16] =

@ -56,6 +56,7 @@ extern void eeprom_update_sys(void);
extern void eeprom_update_performance(void); extern void eeprom_update_performance(void);
extern void eeprom_update_fx(void); extern void eeprom_update_fx(void);
extern void eeprom_update_dexed(uint8_t instance_id); extern void eeprom_update_dexed(uint8_t instance_id);
extern float pseudo_log_curve(float value, bool type);
#ifdef DISPLAY_LCD_SPI #ifdef DISPLAY_LCD_SPI
extern void change_disp_sd(bool d); extern void change_disp_sd(bool d);
@ -1139,7 +1140,8 @@ void UI_func_chorus_level(uint8_t param)
lcd_display_bar_int("Chorus Lvl.", configuration.fx.chorus_level[instance_id], 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false, false); lcd_display_bar_int("Chorus Lvl.", configuration.fx.chorus_level[instance_id], 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false, false);
chorus_mixer[instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0)); chorus_mixer[instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true));
chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0), true));
} }
if (LCDML.FUNC_close()) // ****** STABLE END ********* if (LCDML.FUNC_close()) // ****** STABLE END *********

Loading…
Cancel
Save