From 542317117d16332b6727c8accabb98fca268be8e Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Tue, 19 May 2020 07:42:27 +0200 Subject: [PATCH] Fixes for volume pseudo-log volume handling. --- MicroDexed.ino | 18 ++++++++---------- UI.hpp | 7 +++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index d43768a..837fee7 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1451,7 +1451,7 @@ void initial_values_from_eeprom(bool init) //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))); //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))); //chorus_mixer[instance_id]->gain(0, 1.0 - mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); - chorus_mixer[instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5))); + chorus_mixer[instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); delay_mixer[instance_id]->gain(0, 1.0); delay_mixer[instance_id]->gain(1, pseudo_log_curve(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); @@ -1757,9 +1757,7 @@ 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 - pseudo_log_curve(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))); - //chorus_mixer[instance_id]->gain(0, 1.0 - mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); + chorus_mixer[instance_id]->gain(0, 1.0 - mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); chorus_mixer[instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); switch (configuration.fx.chorus_waveform[instance_id]) { @@ -1847,12 +1845,12 @@ float pseudo_log_curve(float value) { const float _pseudo_log = 1048575 / (float)(1 << 20); -#ifdef DEBUG - Serial.print(F("value in: ")); - Serial.print(value, 3); - Serial.print(F(" value out: ")); - Serial.println(mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0), 3); -#endif + /* #ifdef DEBUG + Serial.print(F("value in: ")); + Serial.print(value, 3); + Serial.print(F(" value out: ")); + Serial.println(mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0), 3); + #endif */ return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0)); } diff --git a/UI.hpp b/UI.hpp index 4c38525..8e3a53d 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1211,9 +1211,7 @@ void UI_func_chorus_level(uint8_t param) lcd_display_bar_int("Chorus Lvl.", configuration.fx.chorus_level[selected_instance_id], 1.0, CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 3, false, false, false); - //chorus_mixer[selected_instance_id]->gain(0, 1.0 - pseudo_log_curve(mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0))); - //chorus_mixer[selected_instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 1.0))); - //chorus_mixer[selected_instance_id]->gain(0, 1.0 - mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); + chorus_mixer[selected_instance_id]->gain(1, 1.0 - mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); chorus_mixer[selected_instance_id]->gain(1, mapfloat(configuration.fx.chorus_level[selected_instance_id], CHORUS_LEVEL_MIN, CHORUS_LEVEL_MAX, 0.0, 0.5)); } @@ -1320,7 +1318,7 @@ void UI_func_delay_feedback(uint8_t param) lcd_display_bar_int("Delay Feedb.", configuration.fx.delay_feedback[selected_instance_id], 1.0, DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 3, false, false, false); - delay_fb_mixer[selected_instance_id]->gain(1, configuration.fx.delay_feedback[selected_instance_id] / 100.0); // amount of feedback + delay_fb_mixer[selected_instance_id]->gain(1, pseudo_log_curve(mapfloat(configuration.fx.delay_feedback[selected_instance_id], DELAY_FEEDBACK_MIN, DELAY_FEEDBACK_MAX, 0.0, 1.0))); // amount of feedback } if (LCDML.FUNC_close()) // ****** STABLE END ********* @@ -1879,6 +1877,7 @@ void UI_func_sound_intensity(uint8_t param) } lcd_display_bar_int("Voice Level", configuration.dexed[selected_instance_id].sound_intensity, 1.0, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 3, false, false, false); + dexed_level[selected_instance_id]->gain(pseudo_log_curve(mapfloat(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX))); }