aboutsummaryrefslogtreecommitdiff
path: root/mixer.c
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-06-06 14:41:02 -0700
committerSimon Wilson <simonwilson@google.com>2011-06-06 14:41:02 -0700
commitb9d4f6bfee008efe1c38eea80fdabf1886c26cf0 (patch)
tree87639dab29b52f2b25755efe671dc7cdf5eb62f5 /mixer.c
parentc6f3e464f5e1d2f5c0f225ef9059674bd109036e (diff)
Add integer range getters to mixer
Diffstat (limited to 'mixer.c')
-rw-r--r--mixer.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/mixer.c b/mixer.c
index eedcbb7..2bb37a1 100644
--- a/mixer.c
+++ b/mixer.c
@@ -372,6 +372,40 @@ int mixer_ctl_set_value(struct mixer_ctl *ctl, unsigned int id, int value)
return ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_WRITE, &ev);
}
+int mixer_ctl_get_range_min(struct mixer_ctl *ctl)
+{
+ struct snd_ctl_elem_value ev;
+
+ if (!ctl || (ctl->info->type != SNDRV_CTL_ELEM_TYPE_INTEGER)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(&ev, 0, sizeof(ev));
+ ev.id.numid = ctl->info->id.numid;
+ if (ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_READ, &ev))
+ return -1;
+
+ return ctl->info->value.integer.min;
+}
+
+int mixer_ctl_get_range_max(struct mixer_ctl *ctl)
+{
+ struct snd_ctl_elem_value ev;
+
+ if (!ctl || (ctl->info->type != SNDRV_CTL_ELEM_TYPE_INTEGER)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ memset(&ev, 0, sizeof(ev));
+ ev.id.numid = ctl->info->id.numid;
+ if (ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_READ, &ev))
+ return -1;
+
+ return ctl->info->value.integer.max;
+}
+
unsigned int mixer_ctl_get_num_enums(struct mixer_ctl *ctl)
{
if (!ctl) {