[alsa-devel] [PATCH] ascenario: Add scenario support to alsa-lib

Jaroslav Kysela perex at perex.cz
Wed Oct 7 10:10:06 CEST 2009


On Tue, 6 Oct 2009, Takashi Iwai wrote:

>> binding. What's awful on this?
>>
>> CTL{reset}="mixer"
>> CTL{name}="Master Playback Volume", CTL{value}="-21dB"
>> CTL{name}="Master Playback Switch", CTL{value}="on"
>> CTL{name}="Headphone Playback Switch", CTL{value}="on,on"
>> CTL{name}="Front Playback Volume", CTL{value}="-29dB,-29dB"
>> CTL{name}="Front Playback Switch", CTL{value}="on,on"
>> CTL{name}="PCM Playback Volume", CTL{value}="0dB,0dB"
>
> This is all fine, but as you wrote below:
>
>> Solving complex tasks requires complex description.
>
> This is the reality.
> The alsactl's default config shows its limit.
>
>> I'm open to
>> discuss things to make this udev-like syntax more nice. The most
>> irritating thing in this syntax are build-in commands for me, but having
>> another special key for these actions are not a big win, because
>> configuration writers must learn them.
>
> The crazy goto is also painful.  It reminds me the day of MS BASIC.

I'm going to change the CTL build-in command to something more readable 
like:

Old syntax:

CTL{reset}="mixer"
CTL{name}="Playback Volume",PROGRAM=="__ctl_search", \
   CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}"

New syntax:

CTL{reset}="mixer"
CTL{name}="Playback Volume",CTL{do_search}=="1", \
   CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="$env{ppercent}"

But regarding goto, I'm really stuck. We can add some block control:

BEGIN="" .. END="" (looks like a goto anyway)

Or skip some lines:

SKIPLINES="3"

But these solutions do not bring much readability. Another possibility 
(compromise) is to use a goto command to skip all lines to next label to 
reduce usage of named labels (which is not a big fun at least in 
init/default file):

GOTO=""
....
LABEL=""

It works without any code change in current parser.

 					Jaroslav

-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.



More information about the Alsa-devel mailing list