diff options
author | Frédéric Boisnard <fredericx.boisnard@intel.com> | 2013-09-17 22:43:18 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-04-22 15:29:24 +0200 |
commit | 9e2c240f20f82159b59c37ed3c722c1279f7863e (patch) | |
tree | 47299577ba50514919fd0be522044098538246f7 /include | |
parent | 782bfda5e796cb46d0e7be0dc882ff686d5ad2a2 (diff) |
Add a function to disambiguate duplicate control names
Control names are not unique and can be shared by multiple mixers controls.
When this happens, there is no way of accessing the mixer using its control
name, because mixer_get_ctl_by_name() always returns the first match. The only
way of accessing the mixer is through its control number, i.e. using
mixer_get_ctl().
This patch adds the function mixer_get_ctl_by_name_and_index() to offer the
possibility to retrieve a control through its name and index. This index
corresponds to the nth occurence of the control name in the global supported
controls names list.
Change-Id: Ie29bf2a949ecf69f106bbe359155cdbfbe98928c
Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com>
Signed-off-by: David Wagner <david.wagner@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-Tracking-BZ: 139255
Diffstat (limited to 'include')
-rw-r--r-- | include/tinyalsa/asoundlib.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index 3d20b94..873b9c9 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -215,6 +215,9 @@ const char *mixer_get_name(struct mixer *mixer); unsigned int mixer_get_num_ctls(struct mixer *mixer); struct mixer_ctl *mixer_get_ctl(struct mixer *mixer, unsigned int id); struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name); +struct mixer_ctl *mixer_get_ctl_by_name_and_index(struct mixer *mixer, + const char *name, + unsigned int index); /* Get info about mixer controls */ const char *mixer_ctl_get_name(struct mixer_ctl *ctl); |