From 90927a5a282d37a30ef84db607678ef0ba640bdb Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Mon, 25 May 2020 11:27:14 +0200 Subject: [PATCH] Fixing log volume curve. --- MicroDexed.ino | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index 2f54967..595b7e8 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1817,7 +1817,7 @@ 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); + //const float _pseudo_log = 1048575 / (float)(1 << 20); /* #ifdef DEBUG Serial.print(F("value in: ")); @@ -1827,16 +1827,10 @@ float pseudo_log_curve(float value) #endif */ - return (mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0)); - - /* - float g = mapfloat(_pseudo_log * arm_sin_f32(value), 0.0, _pseudo_log * arm_sin_f32(1.0), 0.0, 1.0); - - if (g == 0.0) - return (0.001); - else - return (g); - */ + //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)); + return (pow(2, value) - 1); } uint32_t crc32(byte * calc_start, uint16_t calc_bytes) // base code from https://www.arduino.cc/en/Tutorial/EEPROMCrc