[alsa-devel] [RFC, alsa-utils] RFC: alsamixer: Improve description of playback switches

Takashi Sakamoto o-takashi at sakamocchi.jp
Tue Mar 27 00:03:06 CEST 2018


Hi,

On Mar 27 2018 03:42, Kirill Marinushkin wrote:
> On 03/26/18 10:19, Takashi Sakamoto wrote:
>> Hi,
>>
>> On Mar 26 2018 14:11, Kirill Marinushkin wrote:
>>> Currently, all playback switches are described as mute. It is shown as:
>>>
>>> [OO] == sound is on (left and right channels)
>>> [MM] == sound is muted (left and right channels)
>>>
>>> But cards can have different kinds of switch controls, not only mute. At
>>> least usb-audio provides boolean controls as playback switches for:
>>>
>>> * clock source validity (read only switch)
>>> * processing features on/off (rw switch)
>>> * potentially other similar use-cases
>>>
>>> It becames confusing, because it is shown as:
>>>
>>> [OO] == clock source is valid
>>> [MM] == clock source is invalid
>>>
>>> [OO] == processing feature is on
>>> [MM] == processing feature is off
>>>
>>> And from the help, it is not clear how to toggle such switches.
>>
>> Could you show such control elements to help reviewers? For example, output from 'amixer' might be enough.
>>
> 
> Hello Takashi Sakamoto,
> 
> I misread your message. You mean the amixer output, not the alsamixer.
> Below I attach the output from amixer.
> 
> $ amixer -c2
> Simple mixer control 'Clock Source 15 Validity',0
>    Capabilities: pswitch pswitch-joined
>    Playback channels: Mono
>    Mono: Playback [on]
> Simple mixer control 'Up Down',0
>    Capabilities: pswitch pswitch-joined
>    Playback channels: Mono
>    Mono: Playback [on]
> Simple mixer control 'Up Down Mode Select',0
>    Capabilities: volume volume-joined
>    Playback channels: Mono
>    Capture channels: Mono
>    Limits: 0 - 1
>    Mono: 1 [100%]

Thanks. Then you can see corresponding control elements with the same 
name in output of 'amixer -c2 contents'. I guess:

$ amixer -c 2 contents | grep -B1 -A1 BOOLEAN
...
numid=?,iface=MIXER,name='Clock Source 15 Validity'
   ; type=BOOLEAN,access=rw------,values=1
   : values=on
numid=?,iface=MIXER,name='Up Down'
   ; type=BOOLEAN,access=rw------,values=1
   : values=on
...

A control element of 'Up Down Mode Select' is not the one of BOOLEAN 
type so it's not issued one in your patch.

For example, in my case (E-MU 0404 USB, kernel v4.13):

$ amixer -c 1
...
Simple mixer control 'AnalogueIn Soft Limit  ',0
   Capabilities: pswitch pswitch-joined
   Playback channels: Mono
   Mono: Playback [on]
Simple mixer control 'Clock rate Selector',0
   Capabilities: volume volume-joined
   Playback channels: Mono
   Capture channels: Mono
   Limits: 0 - 5
   Mono: 0 [0%]
Simple mixer control 'DigitalIn CLK source External',0
   Capabilities: pswitch pswitch-joined
   Playback channels: Mono
   Mono: Playback [off]
Simple mixer control 'DigitalOut format: SPDIF/AC3',0
   Capabilities: pswitch pswitch-joined
   Playback channels: Mono
   Mono: Playback [off]

These mixer elements are translated by alsa-lib's mixer API 
implementation from control elements maintained by ALSA control core. In 
my case:

$ amixer -c 1 contents | grep -B1 -A1 BOOLEAN
numid=4,iface=MIXER,name='PCM Playback Switch'
   ; type=BOOLEAN,access=rw------,values=1
   : values=on
--
numid=9,iface=MIXER,name='AnalogueIn Soft Limit  '
   ; type=BOOLEAN,access=rw------,values=1
   : values=on
--
numid=8,iface=MIXER,name='DigitalIn CLK source External'
   ; type=BOOLEAN,access=rw------,values=1
   : values=off
numid=6,iface=MIXER,name='DigitalOut format: SPDIF/AC3'
   ; type=BOOLEAN,access=rw------,values=1
   : values=off

Well, if your aim is just to focus on UI issue, it's enough to change 
alsamixer. On the other hand, developers tend to add any control element 
categorized to 'mixer' iface without enough care of its meaning. What 
you see is this kind of control elements, I guess. If you wish to 
suppress alsamixer to handle such non-traditional mixer controls (I mean 
they're not for gain/level/pan/mute etc), it's better to have extra 
care; e.g. backward compatibility.


Regards

Takashi Sakamoto


More information about the Alsa-devel mailing list