diff options
author | Taylor Holberton <taylorcholberton@gmail.com> | 2016-09-16 09:22:18 -0400 |
---|---|---|
committer | Taylor Holberton <taylorcholberton@gmail.com> | 2016-09-16 09:22:18 -0400 |
commit | 7687f0fa2a222c4793de93fb4eeb70323b1603ed (patch) | |
tree | 03a6a6ebd9e977cdbcb98f0d4b59f944a9ad3e94 /mixer.c | |
parent | 713e656a07d7530a2036e3af2972c6da226fb684 (diff) | |
parent | 9e2c240f20f82159b59c37ed3c722c1279f7863e (diff) |
Merge branch 'address-duplicate-control-names' of https://github.com/dawagner/tinyalsa into dawagner-address-duplicate-control-names
Diffstat (limited to 'mixer.c')
-rw-r--r-- | mixer.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -189,6 +189,13 @@ 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) { + return mixer_get_ctl_by_name_and_index(mixer, name, 0); +} + +struct mixer_ctl *mixer_get_ctl_by_name_and_index(struct mixer *mixer, + const char *name, + unsigned int index) +{ unsigned int n; struct mixer_ctl *ctl; @@ -199,7 +206,8 @@ struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name) for (n = 0; n < mixer->count; n++) if (!strcmp(name, (char*) ctl[n].info.id.name)) - return &ctl[n]; + if (index-- == 0) + return mixer->ctl + n; return NULL; } |