[PATCH] sound: pci/rme9652 - implement and expose controls for output

Takashi Iwai tiwai at suse.de
Mon Feb 1 09:42:45 CET 2021


On Sun, 31 Jan 2021 22:37:32 +0100,
fassl wrote:
> 
> >From 980aa253c17d233966e05a43f3611693e2e02040 Mon Sep 17 00:00:00 2001
> From: Jasmin Fazlic <superfassl at gmail.com>
> Date: Sun, 31 Jan 2021 22:17:22 +0100
> Subject: [PATCH] sound: pci/rme9652 - implement and expose controls for output
>  loopback
> 
> - so far only tested and enabled for RME HDSP9632
> 
> Signed-off-by: Jasmin Fazlic <superfassl at gmail.com>

Could you give a bit more description?  What exactly the additions do?

About the code change:
> +static int snd_hdsp_loopback_info(struct snd_kcontrol *const kcontrol,
> +                  struct snd_ctl_elem_info *const uinfo)
> +{
> +    uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
> +    uinfo->count = 1;
> +    uinfo->value.integer.min = 0;
> +    uinfo->value.integer.max = 1;
> +    return 0;
> +}

This is identical with snd_ctl_boolean_mono_info.

> +static struct snd_kcontrol_new snd_hdsp_loopback_control = {
> +    .iface = SNDRV_CTL_ELEM_IFACE_HWDEP,
> +    .name = "Output Loopback",
> +    .index = 0,
> +    .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
> +    .info = snd_hdsp_loopback_info,
> +    .get = snd_hdsp_loopback_get,
> +    .put = snd_hdsp_loopback_put
> +};

IFACE_HWDEP is used in hdsp driver because it's a sort of special
mixer setup.  I don't know your mixer stuff need to follow that.

>  static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp)
>  {
>      unsigned int idx;
> @@ -3297,6 +3363,17 @@ static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp)
>          }
>      }
>  
> +    /* Output loopback controls for H9632 cards */
> +    if (hdsp->io_type == H9632) {
> +        for (idx = 0; idx < hdsp->max_channels; idx++) {
> +            snd_hdsp_loopback_control.index = idx;
> +            kctl = snd_ctl_new1(&snd_hdsp_loopback_control, hdsp);
> +            err = snd_ctl_add(card, kctl);
> +            if (err < 0)
> +                return err;
> +        }
> +    }

snd_ctl_new() can be used for allocating the multiple instances in one
kcontrol.  If the kctl object is created in this way, you'd just need
to change your code to retrieve the kctl index via
snd_ctl_get_ioff() instead of referring to kctl->index directly.


thanks,

Takashi


More information about the Alsa-devel mailing list