From 57a877495e9bd8e2e1ea8fd42bacbc149a6cbcd3 Mon Sep 17 00:00:00 2001 From: Richard Fitzgerald Date: Tue, 9 Sep 2014 16:54:12 +0100 Subject: mixer: Add mixer_ctl_get_id Add a function to get an id of a control that can be passed to mixer_get_ctl(). This can be used to lookup a control by name and store its id for later use rather than have the overhead of name lookup each time it is used. Lookup by id is quick and avoids the disadvantage that storing a pointer to the mixer_ctl object creates a client with a dependency on the address of the internal control array. Signed-off-by: Richard Fitzgerald --- include/tinyalsa/asoundlib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index a85e810..584cfe1 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -225,6 +225,7 @@ 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); /* Get info about mixer controls */ +unsigned int mixer_ctl_get_id(struct mixer_ctl *ctl); const char *mixer_ctl_get_name(struct mixer_ctl *ctl); enum mixer_ctl_type mixer_ctl_get_type(struct mixer_ctl *ctl); const char *mixer_ctl_get_type_string(struct mixer_ctl *ctl); -- cgit v1.2.3