mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-06 13:29:59 -05:00
ucm: implement MacroDefine and Macro subtree evaluation
The arguments are set as temporary variables as /MACRO_NAME/_/ARGUMENT_NAME/.
Example:
# define new macro MyMacro with arguments ctl_name and ctl_value
DefineMacro.MyMacro {
BootSequence [
cset "name='${var:MyMacro_ctl_name}' ${var:MyMacro_ctl_value}"
]
}
# instantiate macro for Speaker control (short version)
Macro.headphone.MyMacro "ctl_name='Speaker Switch',ctl_value=off"
# instantiate macro for Mic control (second version)
Macro.mic.MyMacro {
ctl_name "Mic Switch"
ctl_value "off"
}
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
3e5a894378
commit
d7d5c724ed
6 changed files with 252 additions and 9 deletions
|
|
@ -866,6 +866,12 @@ int uc_mgr_substitute_tree(snd_use_case_mgr_t *uc_mgr, snd_config_t *node)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
/* exception - macros are evaluated when instantied */
|
||||
err = snd_config_get_id(node, &id);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if (id && strcmp(id, "DefineMacro") == 0)
|
||||
return 0;
|
||||
snd_config_for_each(i, next, node) {
|
||||
n = snd_config_iterator_entry(i);
|
||||
err = uc_mgr_substitute_tree(uc_mgr, n);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue