[alsa-devel] alsactl adds volume controls?

Sebastian H. vand2 at gmx.de
Thu Sep 2 22:28:08 CEST 2010

Am 02.09.2010 19:28, schrieb Jaroslav Kysela:
> 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.
>> to avoid problems due to unexpected error codes in mixer applications,
>> but the last value that it had before becoming inactive isn't likely to
>> be interesting to anyone.)
> The read only value can be used with a monitoring application to set the 
> original value back for a reason.

(this may be a bit off topic)

Working on the alsamixer-qt4 application I found that something like
snd_mixer_selem_is_writable ( ... )
snd_mixer_selem_is_readable ( ... )
would be quite useful.

E.g. there are elements like "Equalizer Peaks"
or there could be elements like "Headphones plugged in"
that are only meant to be read.
But right now there's no way to tell from the snd_mixer_selem_* API
if an element/channel is read-only.
In alsamixer-qt4 this can cause floods of error messages
when a GUI-Widget tries to write to such an element.

Thinking of "Equalizer Peaks" also something like
snd_mixer_selem_needs_poll ( ... )
or maybe
snd_mixer_selem_is_volatile ( ... )
would be interesting to know about for a mixer application.

My two cents for a snd_mixer_selem_* wishlist ;-)

Sebastian H.

More information about the Alsa-devel mailing list