From 9c39397e5915f50888519a2032f5ebaa2636b1b5 Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Wed, 29 Jun 2022 17:13:37 +0200 Subject: [PATCH] Went back to linear volume curve --- software/main/src/volume.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/software/main/src/volume.cpp b/software/main/src/volume.cpp index 800aa27..2871dd1 100644 --- a/software/main/src/volume.cpp +++ b/software/main/src/volume.cpp @@ -23,13 +23,13 @@ static _lock_t lock; // Helper functions for converting between internal volume level and radio volume level // Since most of the time we are going to be around a radio volume of 15 the scaling is non-linear static uint8_t to_radio_volume(uint8_t volume) { - /* return floor(volume / 4.2f); */ - return ceil((30.f / pow(127.f, 2)) * pow(volume, 2)); + return floor(volume / 4.2f); + /* return ceil((30.f / pow(127.f, 2)) * pow(volume, 2)); */ } static uint8_t from_radio_volume(uint8_t volume) { - /* return ceil(volume * 4.2f); */ - return floor((127.f / sqrt(30.f)) * sqrt(volume)); + return ceil(volume * 4.2f); + /* return floor((127.f / sqrt(30.f)) * sqrt(volume)); */ } void volume_controller::cancel_sync() { @@ -37,7 +37,7 @@ void volume_controller::cancel_sync() { } void volume_controller::set_from_radio(int v) { - ESP_LOGI(VOLUME_TAG, "Volume on radio updated: %i (0-30)", v); + /* ESP_LOGI(VOLUME_TAG, "Volume on radio updated: %i (0-30)", v); */ // Update the radio volume _lock_acquire(&lock); radio_volume = v;