OSDN Git Service

pcm: softvol: Allow up to 90 dB of gain
authorRicard Wanderlof <ricard.wanderlof@axis.com>
Wed, 18 Apr 2018 15:03:09 +0000 (17:03 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 20 Apr 2018 07:30:25 +0000 (09:30 +0200)
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 <ricardw@axis.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_softvol.c

index 8bb4a39..0eaeace 100644 (file)
@@ -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,