From 710df882fa36faa045c1ed38e589f080eaf3a002 Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Fri, 28 Jun 2013 16:17:50 -0700 Subject: mixer: add mixer_ctl_update() API Some sound cards update their controls due to external events, such as HDMI EDID byte data changing when an HDMI cable is connected. This API allows the count of elements to be updated. --- include/tinyalsa/asoundlib.h | 6 ++++++ mixer.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index ddd7a01..525fef7 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -215,6 +215,12 @@ unsigned int mixer_ctl_get_num_enums(struct mixer_ctl *ctl); const char *mixer_ctl_get_enum_string(struct mixer_ctl *ctl, unsigned int enum_id); +/* Some sound cards update their controls due to external events, + * such as HDMI EDID byte data changing when an HDMI cable is + * connected. This API allows the count of elements to be updated. + */ +void mixer_ctl_update(struct mixer_ctl *ctl); + /* Set and get mixer controls */ int mixer_ctl_get_percent(struct mixer_ctl *ctl, unsigned int id); int mixer_ctl_set_percent(struct mixer_ctl *ctl, unsigned int id, int percent); diff --git a/mixer.c b/mixer.c index 7419d3f..a413c60 100644 --- a/mixer.c +++ b/mixer.c @@ -195,6 +195,11 @@ struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name) return NULL; } +void mixer_ctl_update(struct mixer_ctl *ctl) +{ + ioctl(ctl->mixer->fd, SNDRV_CTL_IOCTL_ELEM_INFO, ctl->info); +} + const char *mixer_ctl_get_name(struct mixer_ctl *ctl) { if (!ctl) -- cgit v1.2.3