diff --git a/MicroDexed.ino b/MicroDexed.ino index 595b7e8..77a95f0 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -687,13 +687,7 @@ void handleControlChange(byte inChannel, byte inCtrl, byte inValue) Serial.println(F("VOLUME CC")); #endif //configuration.dexed[instance_id].sound_intensity = map(inValue, 0, 0x7f, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX); - /*#ifdef USE_FX - MicroDexed[instance_id]->fx.Gain = mapfloat(configuration.dexed[instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX); - #else*/ - - //dexed_level[instance_id]->gain(pseudo_log_curve(mapfloat(map(inValue, 0, 0x7f, 0, configuration.dexed[instance_id].sound_intensity), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX))); // That's not right... have to fix this! - MicroDexed[instance_id]->fx.Gain = mapfloat(map(inValue, 0, 0x7f, 0, configuration.dexed[instance_id].sound_intensity), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX); - //#endif + MicroDexed[instance_id]->fx.Gain = pseudo_log_curve(mapfloat(map(inValue, 0, 0x7f, 0, configuration.dexed[instance_id].sound_intensity), SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); if (LCDML.FUNC_getID() == LCDML.OTHER_getIDFromFunction(UI_func_sound_intensity)) { LCDML.OTHER_updateFunc(); @@ -1814,19 +1808,6 @@ void _softRestart(void) float pseudo_log_curve(float value) { - // ideas from here: https://forum.pjrc.com/threads/56015-Changing-Volume-Levels-based-on-pot-wheel - - - //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 - */ - //return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0)); //return (1 - sqrt(1 - value * value)); //return (pow(value, 2)); diff --git a/UI.hpp b/UI.hpp index ddb82d8..3c2c519 100644 --- a/UI.hpp +++ b/UI.hpp @@ -1887,7 +1887,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); - MicroDexed[selected_instance_id]->fx.Gain = mapfloat(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX); + MicroDexed[selected_instance_id]->fx.Gain = pseudo_log_curve(mapfloat(configuration.dexed[selected_instance_id].sound_intensity, SOUND_INTENSITY_MIN, SOUND_INTENSITY_MAX, 0.0, SOUND_INTENSITY_AMP_MAX)); } if (LCDML.FUNC_close()) // ****** STABLE END *********