[alsa-devel] Question about snd_mixer_selem_get_playback_dB_range()

Clemens Ladisch clemens at ladisch.de
Tue Mar 22 08:11:09 CET 2011


Peter Ujfalusi wrote:
> Looking at the patch itself, it does going to return
> min=SND_CTL_TLV_DB_GAIN_MUTE from snd_tlv_get_dB_range function.
> 
> However I have my doubts, if this is the correct way...
> 
> Take these two gain controls for example:
> RAW value   GAIN1  GAIN2
>    0        mute   mute
>    1        -2dB   0dB
>    2         0dB   1dB
>    3         2dB   2dB
> 
> If user space asks for the dB_range:
>         min    max
> GAIN1   mute   2dB
> GAIN2   mute   2dB
> 
> They are going to return with the same range, however if you ask for
> -2dB on both:
> GAIN1 will be -2dB
> GAIN2 will be muted

Or not, depending on which direction you instruct it to round.

> So we are kind of hiding the dB range for the control.

This is unavoidable if the only information returned is min/max.
To get the entire curve and resolution, you'd have to get the dB value
for each raw volume value.


Regards,
Clemens


More information about the Alsa-devel mailing list