diff options
author | Simon Wilson <simonwilson@google.com> | 2011-06-06 14:41:02 -0700 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-06-06 14:41:02 -0700 |
commit | b9d4f6bfee008efe1c38eea80fdabf1886c26cf0 (patch) | |
tree | 87639dab29b52f2b25755efe671dc7cdf5eb62f5 /mixer.c | |
parent | c6f3e464f5e1d2f5c0f225ef9059674bd109036e (diff) |
Add integer range getters to mixer
Diffstat (limited to 'mixer.c')
-rw-r--r-- | mixer.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -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) { |