[alsa-devel] [PATCH v3 2/4] ALSA: usb-audio: Add usb_mixer_elem_enum_info
Takashi Iwai
tiwai at suse.de
Thu Oct 30 08:17:47 CET 2014
At Wed, 29 Oct 2014 15:56:01 -0500,
Chris J Arges wrote:
>
> Add structure to hold enumeration control information and in addition add it
> to the usb_mixer_elem_info structure. This allows this structure to be more
> easily reused.
Since this information is specific to Scarlett, we don't have to put
in the common place. Instead, define this locally in
mixer_scarlett.c, redefine the mixer info struct like
struct scarlett_mixer_elem_info {
struct usb_mixer_elem_info head;
const struct scarlett_enum_info *opt;
};
and allocate this struct, and cast between usb_mixer_elem_info and
scarlett_mixer_elem_info.
Another way would be to add a pointer to usb_mixer_elem_info, but just
an opaque void pointer instead of a specific type.
struct usb_mixer_elem_info {
....
void *private_data;
};
I don't mind either way.
Takashi
>
> Signed-off-by: Chris J Arges <chris.j.arges at canonical.com>
> ---
> sound/usb/mixer.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
> index 73b1f64..cf3967a4 100644
> --- a/sound/usb/mixer.h
> +++ b/sound/usb/mixer.h
> @@ -36,10 +36,17 @@ enum {
> USB_MIXER_U16,
> };
>
> +struct usb_mixer_elem_enum_info {
> + int start;
> + int len;
> + const char * const *names;
> +};
> +
> struct usb_mixer_elem_info {
> struct usb_mixer_interface *mixer;
> struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */
> struct snd_ctl_elem_id *elem_id;
> + const struct usb_mixer_elem_enum_info *opt; /* enum control info */
> unsigned int id;
> unsigned int control; /* CS or ICN (high byte) */
> unsigned int cmask; /* channel mask bitmap: 0 = master */
> --
> 2.1.0
>
More information about the Alsa-devel
mailing list