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

Stefan Schmidt stefan at datenfreihafen.org
Mon Oct 5 11:35:02 CEST 2009


Hello.

On Mon, 2009-10-05 at 11:14, Jaroslav Kysela wrote:
> On Mon, 5 Oct 2009, Stefan Schmidt wrote:
> 
> >On Thu, 2009-10-01 at 17:08, Stefan Schmidt wrote:
> >>
> >>For an updated patch with all your comments inlcuded see below.
> >
> >Here is another update on this patch. Fixed a problem I introduced in the last
> >iteration and changed the config tokens from MasterPlaybackVolume to Master
> >Playback Volume, etc. That's based on a siggestion from Mark which we had
> >offlist. Let me quote it here to explain the good reasoning behind it.
> 
> Question: What's the IDs (integers) returned with
> snd_scenario_get_master_playback_volume() etc. functions?

That is part of the code Liam wrote, but let me answer it (and maybe Liam chime
in if it is wrong or needs more explanation).

It's just the numid of an alsa control which should be used as master playback,
etc in this scenario. It aliases the function we can use with ascenario to the
real ones in alsa which can bedifferent for different scenarios.

> Please, include also some test configuration files to review the
> configuration syntax.

Attached. default.conf is the main configuration file located at
/etc/alsa/scenario/default.conf

playback_hs is an example of scenario syntax and playback_hs_sequence is an
example of the sequence syntax. Both file names are referenced from default.conf
and located under
/etc/alsa/scenario/default/

regards
Stefan Schmidt
-------------- next part --------------
# Test scenario configuration for Machine X
# Author: Joe Bloggs <joe at bloggs.com>
# lines beginning with # are comments

Section "Scenario"

# scenario unique name (mandatory)
	Identifier = "playback speaker"

# scenario file name (mandatory)
	File = "playback_spk"

# scenario audio quality of service (optional) - HIFI, VOICE or SYSTEM
	QoS = HIFI

# alias for master playback volume (optional)
	Master Playback Volume = 8

# alias for master playback switch (optional)
	Master Playback Switch = 2

# alias for master capture volume (optional)
	Master Capture Volume = 3

# alias for master capture switch (optional)
	Master Capture Switch = 4

EndSection

Section "Scenario"

# scenario unique name (mandatory)
	Identifier = "playback headphones"

# scenario file name (mandatory)
	File = "playback_hp"

# scenario audio quality of service (optional) - HIFI, VOICE or SYSTEM
	QoS = HIFI

# alias for master playback volume (optional)
	Master Playback Volume = 10

# alias for master playback switch (optional)
	Master Playback Switch = 20

# alias for master capture volume (optional)
	Master Capture Volume = 30

# alias for master capture switch (optional)
	Master Capture Switch = 40

# Sequencer to allow pre and post scenario changes (optional)
	PreSequenceFile = "playback_hp_sequence"
	PostSequenceFile = "playback_hp_sequence"
EndSection

Section "Scenario"

# scenario unique name (mandatory)
	Identifier = "playback headset"

# scenario file name (mandatory)
	File = "playback_hs"

# scenario audio quality of service (optional) - HIFI, VOICE or SYSTEM
	QoS = HIFI

# alias for master playback volume (optional)
	Master Playback Volume = 1

# alias for master playback switch (optional)
	Master Playback Switch = 2

# alias for master capture volume (optional)
	Master Capture Volume = 3

# alias for master capture switch (optional)
	Master Capture Switch = 4

# Sequencer to allow pre and post scenario changes (optional)
	PreSequenceFile = "playback_hs_sequence"
	PostSequenceFile = "playback_hs_sequence"
EndSection

-------------- next part --------------
1:'Capture Volume':2:65536,65536
2:'Capture Switch':1:1
3:'Master Playback Volume':2:52429,52429
4:'Master Playback Switch':1:1
-------------- next part --------------
# comment
kcontrol "Master Playback Volume" = "23"
kcontrol "Master Playback Switch" = "1"
msleep = 1000000 # fofoof
kcontrol "Master Playback Volume" = "42"


More information about the Alsa-devel mailing list