The Advanced Linux Sound Architecture (ALSA) - library
Find a file
Jörg Krause 85bf991598 pcm: softvol: fix conversion of TLVs min_db and max_dB value
Both, min_dB and max_dB, are floating type whereas the TLV is (always)
unsigned.

The problem with the conversion of a negative floating-point number into an
unsigned integer is, that the behavior is undefined. This may, depending on
the platform, result in a wrong TLV, i.e. for the default values of min_dB
(-51dB) and max_dB (0dB), alsactl generates the following state on an ARM
cpu build with GCC:

	control.1 {
                iface MIXER
                name Master
                value.0 255
                value.1 255
                comment {
                        access 'read write user'
                        type INTEGER
                        count 2
                        range '0 - 255'
                        tlv '00000001000000080000000000000014'
                        dbmin 0
                        dbmax 5100
                        dbvalue.0 5100
                        dbvalue.1 5100
                }
        }

With the fix applied, alsactl stores the correct TLV:

	control.1 {
                iface MIXER
                name Master
                value.0 255
                value.1 255
                comment {
                        access 'read write user'
                        type INTEGER
                        count 2
                        range '0 - 255'
                        tlv '0000000100000008ffffec1400000014'
                        dbmin -5100
                        dbmax 0
                        dbvalue.0 0
                        dbvalue.1 0
                }
        }

Also tested for different combinations of min_dB and max_dB other than the
default values.

Replaces:
http://mailman.alsa-project.org/pipermail/alsa-devel/2016-May/107733.html

Fixes:
http://mailman.alsa-project.org/pipermail/alsa-devel/2016-May/107628.html

Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2016-05-09 14:52:04 +02:00
alsalisp autotools: update style 2014-02-26 08:16:22 +01:00
aserver coverity fixes 2016-01-12 16:26:58 +01:00
doc topology: doxygen: Add doxygen support for topology core. 2015-07-30 17:10:18 +02:00
include topology: Parse front-end DAI name and ID for the PCM 2016-05-09 10:30:40 +02:00
m4 Add the attributes.m4 macro file from xine/lscube. 2008-11-21 13:04:19 +01:00
modules sbase: fixed missing free 2014-09-23 09:04:26 +02:00
src pcm: softvol: fix conversion of TLVs min_db and max_dB value 2016-05-09 14:52:04 +02:00
test test: audio_time: show report validity and accuracy 2015-07-02 17:02:05 +02:00
utils autotools: update style 2014-02-26 08:16:22 +01:00
.gitignore Add src/conf/topology/sklrt286/data/pvt_data to .gitignore 2016-04-28 16:16:08 +02:00
acinclude.m4 fixed for the recent autoconf. 2004-01-26 15:52:17 +00:00
ChangeLog * update to libtool 1.3.3 1999-07-22 12:18:42 +00:00
configure.ac conf: topology: Generate Private data binary blobs 2016-04-28 16:15:30 +02:00
COPYING Updated GNU GPL license (address). 2001-12-30 09:22:54 +00:00
gitcompile Introduce --with-pkgconfdir, add 64-bit defaults to gitcompile 2012-01-20 16:14:44 +01:00
INSTALL doc: fix cross-compiling example 2014-08-25 14:12:38 +02:00
Makefile.am autotools: update style 2014-02-26 08:16:22 +01:00
MEMORY-LEAK Initial version 2003-02-04 14:56:07 +00:00
NOTES Change assert condition in error message handler 2007-10-24 12:53:08 +02:00
TODO Added snd_config_load_override(). 2002-01-09 21:28:15 +00:00