From 4dc602dd7f763a2ceea7c3e01501cdc3e9de375c Mon Sep 17 00:00:00 2001 From: Dana Conrad Date: Tue, 13 Apr 2021 20:59:45 -0500 Subject: erosq: Tweak volume scale to be approximately correct Tested on eros q, everything measured from line out, open circuit. - volume steps were approximately double the dB they were labelled as, so "-2 dB" would result in a change of about -4 dB from maximum (0, +6.2dBV) - maximum volume defining the line out volume only changed every 10 values, and then was not close to correct- "-10 dB" resulted in -2.5 dB from maximum This gets the volume dB approximately correct, and maximum volume correctly sets the line out volume. I was unable to get odd values in the max volume to work, so set the step size to 2 instead of one. For "consumer level" (-10dBV), set to -16. For "Pro level" (+4dBu -> ~1.8dBV), set to -4. Change-Id: I898b85d768153579a893b23551019af88f865d21 --- firmware/drivers/audio/erosqlinux_codec.c | 10 +++++----- firmware/export/erosqlinux_codec.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/firmware/drivers/audio/erosqlinux_codec.c b/firmware/drivers/audio/erosqlinux_codec.c index 2b7d819e82..02c35e3c00 100644 --- a/firmware/drivers/audio/erosqlinux_codec.c +++ b/firmware/drivers/audio/erosqlinux_codec.c @@ -151,7 +151,7 @@ void audiohw_set_frequency(int fsel) } /* min/max for pcm volume */ -const int min_pcm = -430; +const int min_pcm = -740; const int max_pcm = 0; void audiohw_set_volume(int vol_l, int vol_r) @@ -169,7 +169,7 @@ void audiohw_set_volume(int vol_l, int vol_r) output gain, we have to back off on the PCM signal to avoid blowing out the signal. */ - l = r = global_settings.volume_limit; + l = r = global_settings.volume_limit * 10; } else { l = vol_l_hw; r = vol_r_hw; @@ -177,7 +177,7 @@ void audiohw_set_volume(int vol_l, int vol_r) int sw_volume_l = l <= min_pcm ? min_pcm : MIN(l, max_pcm); int sw_volume_r = r <= min_pcm ? min_pcm : MIN(r, max_pcm); - pcm_set_mixer_volume(sw_volume_l / 10, sw_volume_r / 10); + pcm_set_mixer_volume(sw_volume_l / 20, sw_volume_r / 20); } void audiohw_set_lineout_volume(int vol_l, int vol_r) @@ -190,7 +190,7 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) (void)vol_r; if (lineout_inserted()) { - l = r = global_settings.volume_limit; + l = r = global_settings.volume_limit * 10; } else { l = vol_l_hw; r = vol_r_hw; @@ -198,5 +198,5 @@ void audiohw_set_lineout_volume(int vol_l, int vol_r) int sw_volume_l = l <= min_pcm ? min_pcm : MIN(l, max_pcm); int sw_volume_r = r <= min_pcm ? min_pcm : MIN(r, max_pcm); - pcm_set_mixer_volume(sw_volume_l / 10, sw_volume_r / 10); + pcm_set_mixer_volume(sw_volume_l / 20, sw_volume_r / 20); } diff --git a/firmware/export/erosqlinux_codec.h b/firmware/export/erosqlinux_codec.h index c337bb78c7..b6ab58fa74 100644 --- a/firmware/export/erosqlinux_codec.h +++ b/firmware/export/erosqlinux_codec.h @@ -3,7 +3,7 @@ #define AUDIOHW_CAPS (LINEOUT_CAP) -AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -43, 0, -20) +AUDIOHW_SETTING(VOLUME, "dB", 0, 2, -74, 0, -40) //#define AUDIOHW_NEEDS_INITIAL_UNMUTE -- cgit v1.2.3