Subject: Re: alsactl adds volume controls?
Date: Wednesday 29th September 2010 14:26:38 UTC (over 8 years ago)
Hi all, I'm just re-kickstarting this thread after discussing this issue with David on IRC. 'Twas brillig, and Jaroslav Kysela at 02/09/10 18:28 did gyre and gimble: > On Thu, 2 Sep 2010, Clemens Ladisch wrote: > >> Jaroslav Kysela wrote: >>> On Thu, 2 Sep 2010, Clemens Ladisch wrote: >>>> What is the reason for alsactl not trying to restore inactive controls? >>> >>> Most (maybe all - need to check drivers) of inactive control values are >>> reset to the original value when they're going to the active state. >> >> (There are both kinds of inactive controls.) >> >> It wouldn't hurt to restore controls that will be reset later. >> >>> Maybe we need to add another flag - inactive but persistent. >> >> This is more or less implied by the current documentation: >> /* control does actually nothing, but may be updated */ >> >> I'd rather add a flag for controls that will be reset by the driver, >> because this is an action that is done in addition to the 'normal' >> control behaviour. >> >> One could also say that inactive controls that will be reset have a >> value only as long as they are active, i.e., while inactive, there is >> no current value. In other words, while inactive, they should be >> neither readable nor writable. (Hmm, one could make them just readonly > > Another good idea. Ultimately there are a lot of ideas here on how to solve this, but I'd also like to see something quite practical (new APIs etc. can be useful but I'm still not quite understanding things as they work currently, so perhaps my naive summary can provide some insight by being so out of touch! (I live in hope!)). From what I understand: 1. *All* HDA devices have a PCM softvol control. Some use this actively due to the fact they lack a real h/w volume control. Others do not technically "use" it. 2. The PCM softvol has a 51dB range. When it's "active" this presumably works. When it's inactive (which appears to be the case on my primary machine), regardless of what the it's set to, there will be 0dB change. 3. There is a flag when opening PCM device (SND_PCM_NO_SOFTVOL) that will cause the PCM mixer to not have any impact in *all* cases rather than just in the "inactive" case. 4. When looking at only mixer elements (e.g. not opening any streams) there is no way to know whether a given mixer is active or not (with current APIs), i.e. From using only the mixer related API calls, the PCM volume range is always presented as being 0 -> -51dB for the PCM softvol, even when it actually has no effect (i.e. the information presented is highly misleading). Is there a way to know which mixers are active when you open a pcm stream? (and this question applies to both with and without using the SND_PCM_NO_SOFTVOL flag). I don't personally know the API hence this newbie-level question. Firstly, are all of the above statements correct? Have I fundamentally misunderstood something? Moving on, here are my observations about some of the comments on this thread so far. 1. The point about opening "front" for both playback and capture in PA is valid but irrelevant in this case. We are, for the moment, only concerned about playback streams and ensuring that the mixers apparently used to control the volume for that stream are accurate. 2. Using the UCM system to indicate whether a mixer element is relevant or not is a potential nice solution in the future, but it's not available now and it will also require that UCM metadata is available. Perhaps some internal awareness of a mixer being "active" or not can expose this UCM rule automatically? If that is not the case then it will take years for static UCM metadata to be produced to fix this problem and also years for alsa clients to actually use it (thankfully there are not that many alsa clients what would *need* to make use of this - mostly just PA and some independent mixer apps). 3. Using SND_PCM_NO_SOFTVOL at all times would mean we would have to ignore all softvol mixer elements. It is perfectly possible to control the mixer pipeline with no streams active. This could be a solution, (i.e. using this flag at all times in PA, and ignore all softvol mixers) but is it the right one? I'm also not 100% sure about using this in PA. It was used back in 2008: commit ff3f43525d0b528d43a0480d596973d07c920580 Author: Lennart Poettering