[alsa-devel] alsactl adds volume controls?

Colin Guthrie gmane at colin.guthr.ie
Sun Oct 17 13:18:46 CEST 2010

'Twas brillig, and Raymond Yau at 17/10/10 04:39 did gyre and gimble:
> 2010/10/8 Colin Guthrie <gmane at colin.guthr.ie>
>> D: alsa-mixer.c: Activating path analog-output
>> D: alsa-mixer.c: Path analog-output (Analog Output), direction=1,
>> priority=99, probed=yes, supported=yes, has_mute=yes, has_volume=yes,
>> has_dB=yes, min_volume=0, max_volume=31, min_dB=-97.5, max_dB=0
>> D: alsa-mixer.c: Element Master, direction=1, switch=1, volume=1,
>> enumeration=0, required=0, required_absent=0, mask=0x3600000000f66,
>> n_channels=2, override_map=yes
>> D: alsa-mixer.c: Element PCM, direction=1, switch=0, volume=1,
>> enumeration=0, required=0, required_absent=0, mask=0x3600000000f66,
>> n_channels=2, override_map=yes
>> I: alsa-sink.c: Hardware volume ranges from -97.50 dB to 0.00 dB.
>> I: alsa-sink.c: No particular base volume set, fixing to 0 dB
>> I: alsa-sink.c: Using hardware volume control. Hardware dB scale supported.
>> I: alsa-sink.c: Using hardware mute control.
> If step 0 of the Master Volume control is SND_CTL_TLV_DB_GAIN_MUTE (i.e.
> -99999dB) , step 1 is -45dB and step 31 is 0dB
> does it mean that the mixer application can no longer rely on
> snd_mixer_selem_get_playback_dB_range() to get the correct min dB at min
> step from snd_mixer_selem_set_playback_volume_range() ?
> the dB range of PCM soft is -51dB to 0dB
> how do PA calculate the range -97.5dB to -dB as it is not possible to set
> total dB value to -97.5dB any more ?

PA uses the call snd_mixer_selem_set_playback_dB() with a dir argument
of +1. This means that it wont go lower than the dB value it asks for.

After calling this, we check what the value really was set to then go on
and make further adjustment to other elements (e.g. PCM) to get the
needed accuracy. If all mixer elements are exhausted and the final dB
value is still not accurate enough, we do the remainder in software.

So while the range is "interesting", it's not absolutely essential as PA
will always extend the range in software when needed.



Colin Guthrie

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

More information about the Alsa-devel mailing list