diff --git a/MicroDexed.ino b/MicroDexed.ino index 08f2155..35aa46f 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1354,8 +1354,8 @@ void initial_values_from_eeprom(bool init) MicroDexed[instance_id]->doRefreshVoice(); #if defined(USE_FX) - chorus_mixer[instance_id]->gain(0, 1.0); - 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)); 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_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++) { // CHORUS - chorus_mixer[instance_id]->gain(0, 1.0); - 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)); switch (configuration.fx.chorus_waveform[instance_id]) { case 0: @@ -1738,6 +1738,14 @@ void _softRestart(void) 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 { const uint32_t crc_table[16] = diff --git a/UI.hpp b/UI.hpp index 8ecfb30..fa817ba 100644 --- a/UI.hpp +++ b/UI.hpp @@ -56,6 +56,7 @@ extern void eeprom_update_sys(void); extern void eeprom_update_performance(void); extern void eeprom_update_fx(void); extern void eeprom_update_dexed(uint8_t instance_id); +extern float pseudo_log_curve(float value, bool type); #ifdef DISPLAY_LCD_SPI 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); - 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 *********