[alsa-devel] Query regarding ALSA control interface

Pharaoh . pharaoh137 at gmail.com
Tue Jul 24 01:16:11 CEST 2007


Hi
I am writing a pcm control interface for my alsa driver. I am confused about
how the switches are used.
I have implemented simple cases like following and they are working well.

static int audio_path_info(struct snd_kcontrol *kcontrol, struct
snd_ctl_elem_info *uinfo)
{
       /*Count is 256 since the values can vary from 0-255. But values fall
in this range only*/

        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 256;
        uinfo->value.integer.min = 0;
        uinfo->value.integer.max = 255;
        FN_EXIT;
        return 0;
}
static int audio_path_get(struct snd_kcontrol *kcontrol, struct
snd_ctl_elem_value *ucontrol)
{
    my_mixer_t *mixer_chip = snd_kcontrol_chip(kcontrol);
    ucontrol->value.integer.value[0] = mixer_chip->echo;
    ucontrol->value.integer.value[1] = mixer_chip->echo;
    return 0;
}
static int audio_path_put(struct snd_kcontrol *kcontrol, struct
snd_ctl_elem_value *ucontrol)
{
        my_mixer_t *mixer_chip = snd_kcontrol_chip(kcontrol);
       -----
       ----
}


Now, I have to implement a control which takes four different values..namely
0,1.100 and 101. In this case what shoud be the type of control? It should
be ENUMERATED or INTEGER? I am confused here since the values are not
exactly in a range.

-pharaoh.


More information about the Alsa-devel mailing list