On Mon, 15 Jan 2018 14:14:13 +0100, Ricard Wanderlof wrote:
On Fri, 12 Jan 2018, Takashi Iwai wrote:
The ALSA softvol plugin has a maximum gain of 50 dB (MAX_DB_UPPER_LIMIT is fixed to 50 in pcm/pcm_softvol.c). Is there some technical reason for this limit? These days when >16 bit audio is becoming common, it's not unreasonable to have large gain figures, and that is in fact a usecase I have right now.
I'm looking through the CONVERT_AREA and MULTI_DIV_foo macros to see if there's something there that degenerates when the gain factor becomes too large, but I'd thought I'd ask too rather than just do reverse engineering.
There is no more reason than "some reasonable limit".
Ok, my suggestion would be set MAX_DB_UPPER_LIMIT to 90 dB. 90 dB comes out as 31622, which still is manageable when shifted up by VOL_SCALE_SHIFT (= 16), fitting in a 32-bit int. Thus it works in MULTI_DIV_short() too, where it is multiplied with the 16-bit sample value yielding an int.
I'll try it out and prepare a patch.
Well, but +90dB gain doesn't look like a normal usage pattern. Why do you have to use softvol plugin for achieving that specific purpose?
Takashi