[alsa-devel] [PATCH 7/7] M-Audio Fast Track Ultra: Add effect controls

Takashi Iwai tiwai at suse.de
Mon Apr 23 17:11:53 CEST 2012


At Mon, 23 Apr 2012 16:37:37 +0200,
Felix Homann wrote:
> 
> This adds the remaining controls for effects on the FTU devices.
> Some of these controls need volume quirks. They are added to
> mixer.c.
> 
> Signed-off-by: Felix Homann <linuxaudio at showlabor.de>
> 
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index bb56f53..195b6d2 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -770,6 +770,24 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
>  				  struct snd_kcontrol *kctl)
>  {
>  	switch (cval->mixer->chip->usb_id) {
> +	case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
> +	case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */
> +		if ((strcmp(kctl->id.name, "Effect Duration") == 0)) {
> +			snd_printk(KERN_INFO
> +				"usb-audio: set quirk for FTU Effect Duration\n");
> +			cval->min = 0x0000;
> +			cval->max = 0x7f00;
> +			cval->res = 0x0100;
> +			break;
> +		}
> +		if (strcmp(kctl->id.name, "Effect Volume") == 0 ||
> +			strcmp(kctl->id.name, "Effect Feedback Volume") == 0) {
> +			snd_printk(KERN_INFO
> +				"usb-audio: set quirks for FTU Effect Feedback/Volume\n");
> +			cval->min = 0x00;
> +			cval->max = 0x7f;
> +			break;
> +		}
>  	case USB_ID(0x0471, 0x0101):
>  	case USB_ID(0x0471, 0x0104):
>  	case USB_ID(0x0471, 0x0105):
> diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
> index f751137..4d8cc45 100644
> --- a/sound/usb/mixer_quirks.c
> +++ b/sound/usb/mixer_quirks.c
> @@ -584,14 +584,14 @@ struct snd_ftu_eff_switch_priv_val {
>  static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol,
>  					struct snd_ctl_elem_info *uinfo)
>  {
> -	static char *texts[8] = {"Room 1",
> -				 "Room 2",
> -				 "Room 3",
> -				 "Hall 1",
> -				 "Hall 2",
> -				 "Plate",
> -				 "Delay",
> -				 "Echo"
> +	static const char *texts[8] = {"Room 1",

Write it in the first place in that way.


> +				       "Room 2",
> +				       "Room 3",
> +				       "Hall 1",
> +				       "Hall 2",
> +				       "Plate",
> +				       "Delay",
> +				       "Echo"
>  	};
>  
>  	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
> @@ -614,6 +614,13 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,
>  	int err;
>  	unsigned char value[2];
>  
> +	const int id = 6;
> +	const int validx = 1;
> +	const int val_len = 2;
> +
> +	value[0] = 0x00;
> +	value[1] = 0x00;
> +
>  	pval = (struct snd_ftu_eff_switch_priv_val *)
>  		kctl->private_value;
>  
> @@ -630,14 +637,6 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,
>  	if (snd_BUG_ON(!chip))
>  		return -EINVAL;
>  
> -	const int id = 6;
> -	const int validx = 1;
> -	const int val_type = USB_MIXER_S16;

Ditto.  Not good to fix something in a later patch if you already know
it should be fixed.


thanks,

Takashi


More information about the Alsa-devel mailing list