alsa-lib/src
Peter Ujfalusi d81ce4ea7a tlv: Handle 'holes' in SND_CTL_TLVT_DB_RANGE array
When converting from dB to raw value, and DB_RANGE is
used with non overlapping map, dB value in between the
sub ranges will be not found.

For example, if the control has the following:
0: -10dB
1: -5dB
2: 0dB
3: 2dB
4: 4dB

static const unsigned int nonoverlapping_tlv[] = {
        TLV_DB_RANGE_HEAD(2),
        0, 2, TLV_DB_SCALE_ITEM(-1000, 500, 0),
        3, 4, TLV_DB_SCALE_ITEM(200, 200, 0),
};

Range 1: -10 .. 0dB
Range 2: 2 .. 4dB

If user asks for 1dB the snd_tlv_convert_from_dB will not find
the raw value, since the 1dB is not part of either range.

To fix this, we will store the previous non maching range's
maximum raw value. If the dB value is not found in the next range,
we will check, if the requested dB value is in between the current
and the previous range, and if it is than pick the apropriate raw
value based on the xdir (up or down rounding).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2010-07-20 12:55:51 +02:00
..
alisp alisp - Fix a string format ambiguity 2010-05-27 10:17:04 +02:00
compat Corrections by Kevin Conder <kconder@interaccess.com> 2002-03-12 20:14:33 +00:00
conf Change dmix.conf to accept user configuration from defaults.dmix.<driver_id>.xxx 2009-09-09 11:40:03 +02:00
control tlv: Handle 'holes' in SND_CTL_TLVT_DB_RANGE array 2010-07-20 12:55:51 +02:00
hwdep Remove old commented-out FD_CLOEXEC code 2009-11-08 09:23:22 +01:00
mixer mixer: fix enum check 2009-11-23 10:56:46 +01:00
pcm pcm_share plugin: fix pcm->monotonic setup in open() function 2010-04-13 10:08:56 +02:00
rawmidi Remove old commented-out FD_CLOEXEC code 2009-11-08 09:23:22 +01:00
seq seq: Fix for snd_seq_parse_address() 2010-04-22 16:08:14 +02:00
timer Remove redefinition of _GNU_SOURCE and __USE_GNU 2009-11-08 09:28:07 +01:00
async.c Make some static tables and strings constants. 2008-11-21 13:04:41 +01:00
conf.c Use thread-safe locale functions if available 2010-04-21 19:20:39 +02:00
confmisc.c Mark static tables as constant when possible. 2008-11-21 22:39:38 +01:00
dlmisc.c Remove redefinition of _GNU_SOURCE and __USE_GNU 2009-11-08 09:28:07 +01:00
error.c Change assert condition in error message handler 2007-10-24 12:53:08 +02:00
input.c Make all the remaining ops structure constants. 2008-11-21 20:48:33 +01:00
Makefile.am Check for --no-undefined linker flag and use it. 2008-11-21 13:04:26 +01:00
names.c Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:24:55 +02:00
output.c fix doc errors 2009-08-04 09:17:20 +02:00
shmarea.c Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:24:55 +02:00
socket.c Move snd_is_local() to socket.c 2005-11-30 11:31:18 +00:00
userfile.c Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-15 10:24:55 +02:00
Versions.in Fix wrong exported functions 2008-02-04 14:15:44 +01:00