From: Jaroslav Kysela Date: Mon, 22 Feb 2021 12:08:30 +0000 (+0100) Subject: pcm: softvol - do not set TLV access flags for the switch X-Git-Tag: v1.2.5~104 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=24db585dd1edd63eafcc6887ca30bfcb89986718;p=alsa-lib.git pcm: softvol - do not set TLV access flags for the switch Signed-off-by: Jaroslav Kysela --- diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c index f08208f8..1a84ea55 100644 --- a/src/pcm/pcm_softvol.c +++ b/src/pcm/pcm_softvol.c @@ -725,11 +725,13 @@ static int add_user_ctl(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo, int i; unsigned int def_val; - if (svol->max_val == 1) + if (svol->max_val == 1) { + snd_ctl_elem_info_set_read_write(cinfo, 1, 1); err = snd_ctl_add_boolean_elem_set(svol->ctl, cinfo, 1, count); - else + } else { err = snd_ctl_add_integer_elem_set(svol->ctl, cinfo, 1, count, 0, svol->max_val, 0); + } if (err < 0) return err; if (svol->max_val == 1) @@ -817,7 +819,8 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol, SNDERR("Control %s mismatch", tmp_name); return err; } - /* reset numid */ + /* clear cinfo including numid */ + snd_ctl_elem_info_clear(&cinfo); snd_ctl_elem_info_set_id(&cinfo, ctl_id); if ((err = add_user_ctl(svol, &cinfo, cchannels)) < 0) { SNDERR("Cannot add a control");