From: Ricard Wanderlof Date: Wed, 18 Apr 2018 15:03:09 +0000 (+0200) Subject: pcm: softvol: Allow up to 90 dB of gain X-Git-Tag: android-x86-9.0-r1~209 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=23a20cda111232b5d21dde12d10e19e4ecb71cea;p=android-x86%2Fexternal-alsa-lib.git pcm: softvol: Allow up to 90 dB of gain The gain algorithm used in softvol can handle gain factors of up to 32767 which is slightly more than 90 dB, so allow a max_dB of 90 dB. This doesn't affect existing asound.conf files, but does allow a max_dB of up to 90 dB when needed. Tested using Audacity that there is no undue distorsion or other artefacts when 90 dB of gain is applied to a suitable signal (i.e. a signal quiet enough not be clipped whan applying 90 dB of gain). Signed-off-by: Ricard Wanderlof Signed-off-by: Takashi Iwai --- diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c index 8bb4a397..0eaeacef 100644 --- a/src/pcm/pcm_softvol.c +++ b/src/pcm/pcm_softvol.c @@ -59,7 +59,11 @@ typedef struct { #define PRESET_RESOLUTION 256 #define PRESET_MIN_DB -51.0 #define ZERO_DB 0.0 -#define MAX_DB_UPPER_LIMIT 50 +/* + * The gain algorithm as it stands supports gain factors up to 32767, which + * is a fraction more than 90 dB, so set 90 dB as the maximum possible gain. + */ +#define MAX_DB_UPPER_LIMIT 90 static const unsigned int preset_dB_value[PRESET_RESOLUTION] = { 0x00b8, 0x00bd, 0x00c1, 0x00c5, 0x00ca, 0x00cf, 0x00d4, 0x00d9,