Add basic mixer support for M-Audio FTU (8R)
PATCH 1/1 Add basic mixer support for M-Audio FTU (8R)
And again, next try (somehow my mail address has not been accepted despite registration)
This patch (against alsa-kmirror) adds mixer support for M-Audio Fast Track Ultra (8R) devices. It should be suitable as a blueprint for adding mixer support to other devices with missing/wrong descriptors.
I needed to move some enums to header files, raise MAX_CHANNELS, and slightly modify snd_usb_audio_probe().
If this get accepted I will work on the effects unit in the FTU devices. It's straight forward work based on this.
Kind regards,
Felix
PATCH 1/1 Add basic mixer support for M-Audio FTU (8R)
From: Felix Homann <[email protected]>
Signed-off-by Felix Homann <[email protected]>
usb/card.c +5 -0
@@ -489,6 +489,11 @@ static void *snd_usb_audio_probe(struct usb_device *dev,if (!chip->ctrl_intf) chip->ctrl_intf = alts; +/* try to create a mixer for quirked devices, too */ +if (snd_usb_create_mixer (chip, ifnum, ignore_ctl_error) <0 ) { + goto __error; + } +if (err >0 ) {/* create normal USB audio interfaces */ if (snd_usb_create_streams(chip, ifnum) < 0 ||
usb/mixer.c +65 -10
87 lines not on this page · raw message
usb/mixer.h +13 -1
@@ -24,7 +24,16 @@ struct usb_mixer_interface {u8 xonar_u1_status; }; -#define MAX_CHANNELS 10/* max logical channels */ +#define MAX_CHANNELS 16/* max logical channels */ + +enum { +USB_MIXER_BOOLEAN , +USB_MIXER_INV_BOOLEAN , +USB_MIXER_S8 , +USB_MIXER_U8 , +USB_MIXER_S16 , +USB_MIXER_U16 , +};struct usb_mixer_elem_info {struct usb_mixer_interface *mixer;
@@ -53,4 +62,7 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);int snd_usb_mixer_set_ctl_value (struct usb_mixer_elem_info *cval,int request,int validx,int value_set); +int build_named_mixer_unit_ctl (struct usb_mixer_interface *mixer, +int in_pin,int in_ch,int unitid,int val_type,unsigned int cmask, +char * ctrl_name,int channels);#endif /* __USBMIXER_H */
usb/mixer_quirks.c +34 -0
@@ -354,6 +354,32 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, } } +int snd_ftu_controls_create (struct usb_mixer_interface *mixer) +{ +char name[44 ]; +int out, in_ch, unitid, err; +unsigned int cmask; +int val_type =USB_MIXER_S16 ; +int channels =1 ; + unitid =5 ;// FTU's unit id + +for (out =0 ; out <8 ; ++out) { +for (in_ch =0 ; in_ch <16 ; ++in_ch) { + cmask = (1 << in_ch); +if (in_ch <8 ) +sprintf (name,"AIn%d - Out%d Capture Volume" , in_ch +1 , out +1 ); +else if (in_ch >=8 ) +sprintf (name,"DIn%d - Out%d Playback Volume" , in_ch -7 , out +1 ); +if ((err =build_named_mixer_unit_ctl (mixer, in_ch, out, unitid, + val_type, cmask, name, channels))) { +return err; + } + } + } + +return 0 ; +} +int snd_usb_mixer_apply_create_quirk (struct usb_mixer_interface *mixer) {int err;
@@ -379,6 +405,14 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)return err; } +/* M-Audio Fast Track Ultra (8R) */ +if (mixer->chip->usb_id ==USB_ID (0x0763 ,0x2080 ) || + mixer->chip->usb_id ==USB_ID (0x0763 ,0x2081 )) { + err =snd_ftu_controls_create (mixer); +if (err <0 ) +return err; + } +return 0 ; }
usb/usbmixer.h +1 -1
@@ -22,7 +22,7 @@ struct usb_mixer_interface {u8 xonar_u1_status; }; -#define MAX_CHANNELS 10/* max logical channels */ +#define MAX_CHANNELS 16/* max logical channels */ struct usb_mixer_elem_info {struct usb_mixer_interface *mixer;
Signature · 1 line
1.7.1