Add support for volatile buttons to widget-boolean.c

Will be used by Gen 1 support.
This commit is contained in:
Geoffrey D. Bennett
2024-03-31 03:22:38 +10:30
parent db0929bd08
commit 111ec1154d
4 changed files with 35 additions and 3 deletions

View File

@@ -262,7 +262,7 @@ void alsa_set_elem_value(struct alsa_elem *elem, long value) {
// return whether the element can be modified (is writable)
int alsa_get_elem_writable(struct alsa_elem *elem) {
if (elem->card->num == SIMULATED_CARD_NUM)
return elem->writable;
return elem->is_writable;
snd_ctl_elem_info_t *elem_info;
@@ -273,6 +273,21 @@ int alsa_get_elem_writable(struct alsa_elem *elem) {
return snd_ctl_elem_info_is_writable(elem_info);
}
// return whether the element is volatile (can change without
// notification)
int alsa_get_elem_volatile(struct alsa_elem *elem) {
if (elem->card->num == SIMULATED_CARD_NUM)
return elem->is_volatile;
snd_ctl_elem_info_t *elem_info;
snd_ctl_elem_info_alloca(&elem_info);
snd_ctl_elem_info_set_numid(elem_info, elem->numid);
snd_ctl_elem_info(elem->card->handle, elem_info);
return snd_ctl_elem_info_is_volatile(elem_info);
}
// get the number of values this element has
// (most are just 1; the levels element is the exception)
int alsa_get_elem_count(struct alsa_elem *elem) {