[alsa-devel] [PATCH - alsa-lib 2/3] tlv: Handle 'holes' in SND_CTL_TLVT_DB_RANGE array

Peter Ujfalusi peter.ujfalusi at nokia.com
Tue Jul 20 08:06:58 CEST 2010


Hello,

On Monday 19 July 2010 18:51:27 ext Takashi Iwai wrote:
> At Mon, 19 Jul 2010 10:14:05 +0300,
> 
> Peter Ujfalusi wrote:
> > 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.
> 
> In the case above, can't you set like
> 
> 	TLV_DB_RANGE_HEAD(2),
> 	0, 2, TLV_DB_SCALE_ITEM(-1000, 500, 0),
> 	2, 4, TLV_DB_SCALE_ITEM(0, 200, 0)
> 
> ??

This is exactly what I submitted for the drivers I maintain.
Mark suggested that instead of doing this in driver, I should fix this in alsa-
lib level.
This patch tries to do exactly that.
Personally I do prefer the way I patched the drivers, and you are also 
suggesting, but Mark has different opinion, so this has to be worked out.

-- 
Péter


More information about the Alsa-devel mailing list