aboutsummaryrefslogtreecommitdiff
path: root/mixer.c
diff options
context:
space:
mode:
authorSimon Wilson <ksattic@gmail.com>2015-09-15 11:27:32 -0700
committerSimon Wilson <ksattic@gmail.com>2015-09-15 11:27:32 -0700
commit53e232c3ef1f8a4a51dbf97ca56010eadbc4769c (patch)
tree53c34481c922346e945535b962889774f9337bda /mixer.c
parent1c30d6eb6ac4ce3870298c36d44202e13917f588 (diff)
parent57a877495e9bd8e2e1ea8fd42bacbc149a6cbcd3 (diff)
Merge pull request #52 from rfvirgil/get_id
mixer: Add mixer_ctl_get_id
Diffstat (limited to 'mixer.c')
-rw-r--r--mixer.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mixer.c b/mixer.c
index 73ae6da..113f11e 100644
--- a/mixer.c
+++ b/mixer.c
@@ -33,6 +33,7 @@
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
+#include <limits.h>
#include <sys/ioctl.h>
@@ -209,6 +210,17 @@ void mixer_ctl_update(struct mixer_ctl *ctl)
ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_INFO, ctl->info);
}
+unsigned int mixer_ctl_get_id(struct mixer_ctl *ctl)
+{
+ if (!ctl)
+ return UINT_MAX;
+
+ /* numid values start at 1, return a 0-base value that
+ * can be passed to mixer_get_ctl()
+ */
+ return ctl->info->id.numid - 1;
+}
+
const char *mixer_ctl_get_name(struct mixer_ctl *ctl)
{
if (!ctl)