[alsa-devel] [alsa-lib][PATCH] control: initialize element channel values according to identification number at adding a new element

Takashi Iwai tiwai at suse.de
Sun Feb 21 18:50:39 CET 2016


On Sun, 21 Feb 2016 17:54:28 +0100,
Takashi Sakamoto wrote:
> 
> In ALSA control core, there're two ways to identify elements. One is by
> numid. Another is by name/index. The former way is lighter than the latter
> way.
> 
> In control API, after adding elements by snd_ctl_elem_add_integer() and
> snd_ctl_elem_add_integer64(), these functions initialize value of each
> channel. When executing this operation, used ID information is still given
> by applications. Although, in this time, the element can be identified
> according to numid.
> 
> This commit uses the numid instead of name/index pair.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>

Applied, thanks.


Takashi

> ---
>  src/control/control.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/control/control.c b/src/control/control.c
> index a44ae96..8a5d530 100644
> --- a/src/control/control.c
> +++ b/src/control/control.c
> @@ -292,7 +292,7 @@ int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  	if (err < 0)
>  		return err;
>  	snd_ctl_elem_value_alloca(&val);
> -	val->id = *id;
> +	val->id = info->id;
>  	for (i = 0; i < count; i++)
>  		val->value.integer.value[i] = min;
>  	err = ctl->ops->element_write(ctl, val);
> @@ -330,7 +330,7 @@ int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
>  	if (err < 0)
>  		return err;
>  	snd_ctl_elem_value_alloca(&val);
> -	val->id = *id;
> +	val->id = info->id;
>  	for (i = 0; i < count; i++)
>  		val->value.integer64.value[i] = min;
>  	err = ctl->ops->element_write(ctl, val);
> -- 
> 2.5.0
> 


More information about the Alsa-devel mailing list