ucm: implement CardIdByName substitution

The syntax is ${CardIdByName:CARDNAME[#INDEX]}.

The CARDNAME is the ALSA's soundcard name (short form).
The INDEX is the instance (0 = first, 1 = second etc.).

Example: ${CardIdByName:HDA Intel PCH}
(which is identical to ${CardIdByName:HDA Intel PCH#0})

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-06-03 17:12:19 +02:00
parent f60e0d5fdc
commit eee879d381
6 changed files with 135 additions and 56 deletions

View file

@ -115,6 +115,7 @@ struct ctl_list {
struct list_head dev_list;
snd_ctl_t *ctl;
snd_ctl_card_info_t *ctl_info;
int slave;
};
struct ucm_dev_name {
@ -283,10 +284,13 @@ void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr);
void uc_mgr_free(snd_use_case_mgr_t *uc_mgr);
int uc_mgr_open_ctl(snd_use_case_mgr_t *uc_mgr,
snd_ctl_t **ctl,
const char *device);
struct ctl_list **ctl_list,
const char *device,
int slave);
struct ctl_list *uc_mgr_get_one_ctl(snd_use_case_mgr_t *uc_mgr);
struct ctl_list *uc_mgr_get_master_ctl(snd_use_case_mgr_t *uc_mgr);
struct ctl_list *uc_mgr_get_ctl_by_name(snd_use_case_mgr_t *uc_mgr,
const char *name, int idx);
snd_ctl_t *uc_mgr_get_ctl(snd_use_case_mgr_t *uc_mgr);
void uc_mgr_free_ctl_list(snd_use_case_mgr_t *uc_mgr);