All of lore.kernel.org
 help / color / mirror / Atom feed
* Fast Track Ultra mixer - opinions anyone?
@ 2012-04-16 10:38 Felix Homann
  2012-04-16 11:06 ` Aurélien Leblond
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Felix Homann @ 2012-04-16 10:38 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai, Aurélien Leblond, Grant Diffey, Daniel Mack

[-- Attachment #1: Type: text/plain, Size: 1486 bytes --]

Hi,

over the weekend I tried to prepare a
"set-everything-to-zero-by-default" mixer patch. And failed...
I could get the controls to be defaulted to zero by quirking the
volume range, but then there would not have been any sound at all,
even after adjusting the levels.

So without diving any deeper in this I decided to put some work in the
mixer controls. You can find a patch to play with attached to this
mail. I've left a couple of commented quirks in mixer.c so you can
see, where simple changes can be made.

But working on this patch raised a couple of questions I would like
hear your opinions on:

** Effects **

Essentially, with the attached patch you can control everything but
the effect program. The switch should not be too hard to implement.
But before I put any more work on it I would like to ask wether it
makes sense at all.

IMO, the effect section on the FTUs really sucks. I can't believe that
anybody can really use it in a reasonable way. So should we really add
another 40 controls to the mixer which can cause a lot of pain when
misadjusted (i.e. anything else but 0)?

For those reasons I would prefer not to put effect support in the
kernel. What do you think?

** dB values **

Currently alsamixer does not report any dB changes when you change a
control value. I  don't know how to fix it. Anyone else?

** Naming scheme again **

Once again, is everyone pleased with the current naming scheme?



Looking forward for your suggestions.

Regards,

Felix

[-- Attachment #2: ftu-mixer-effects.diff --]
[-- Type: application/octet-stream, Size: 7622 bytes --]

diff --git a/usb/mixer.c b/usb/mixer.c
index ab23869..d24d657 100644
--- a/usb/mixer.c
+++ b/usb/mixer.c
@@ -770,6 +770,53 @@ 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(strnicmp(kctl->id.name, "AIn", 3) == 0
+			| strnicmp(kctl->id.name, "DIn", 3) == 0) {
+			/* quirking the AIn/DIn controls will result in
+			 * 0 default values. But controls will not have any effect
+			 */
+
+			snd_printk(KERN_INFO
+				"set quirks for FTU AIn/DIn controls\n");
+			//cval->min = 0x0000;
+			//cval->max = 0xffff;
+			//break;
+		}
+		if (strcmp(kctl->id.name, "Effect Duration") == 0) {
+			snd_printk(KERN_INFO
+				"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") == 0) {
+			snd_printk(KERN_INFO
+				"set quirks for FTU Effect Feedback/Volume\n");
+			cval->min = 0x00;
+			cval->max = 0x7f;
+			break;
+		}
+		/* if (strnicmp(kctl->id.name, "Effect Return", 10) == 0) { */
+		/* 	snd_printk(KERN_INFO */
+		/* 		"set quirks for FTU Effect returns\n"); */
+		/* 	printk(KERN_ERR "set quirks for FTU Effect Returns"); */
+		/* 	cval->min = 0xcde7; */
+		/* 	cval->max = 0xffda; */
+		/* 	break; */
+		/* } */
+		/* if (strnicmp(kctl->id.name, "Effect Send", 10) == 0) { */
+		/* 	snd_printk(KERN_INFO */
+		/* 		"set quirks for FTU Effect returns\n"); */
+		/* 	printk(KERN_ERR "set quirks for FTU Effect Returns"); */
+		/* 	cval->min = 0xcde7; */
+		/* 	cval->max = 0xffda; */
+		/* 	break; */
+		/* } */
+
 	case USB_ID(0x0471, 0x0101):
 	case USB_ID(0x0471, 0x0104):
 	case USB_ID(0x0471, 0x0105):
diff --git a/usb/mixer_quirks.c b/usb/mixer_quirks.c
index ab125ee..90f7a32 100644
--- a/usb/mixer_quirks.c
+++ b/usb/mixer_quirks.c
@@ -496,6 +496,12 @@ static int snd_nativeinstruments_create_mixer(struct usb_mixer_interface *mixer,
 
 /* M-Audio FastTrack Ultra quirks */
 
+/* Note: Some of the FTU controls need volume control quirks
+ * If you change the naming scheme of the controls you need
+ * to change the corresponding names in volume_control_quirks() 
+ * in mixer.c as well
+ */
+
 /* private_free callback */
 static void usb_mixer_elem_free(struct snd_kcontrol *kctl)
 {
@@ -503,56 +509,208 @@ static void usb_mixer_elem_free(struct snd_kcontrol *kctl)
 	kctl->private_data = NULL;
 }
 
+
 static int snd_maudio_ftu_create_ctl(struct usb_mixer_interface *mixer,
-				     int in, int out, const char *name)
+					unsigned int id,
+					unsigned int control,
+					unsigned int cmask,
+					int val_type,
+					const char *name)
 {
 	struct usb_mixer_elem_info *cval;
-	struct snd_kcontrol *kctl;
+ 	struct snd_kcontrol *kctl;
 
 	cval = kzalloc(sizeof(*cval), GFP_KERNEL);
 	if (!cval)
 		return -ENOMEM;
 
-	cval->id = 5;
+	cval->id = id;
 	cval->mixer = mixer;
-	cval->val_type = USB_MIXER_S16;
+	cval->val_type = val_type;
 	cval->channels = 1;
-	cval->control = out + 1;
-	cval->cmask = 1 << in;
-
+	cval->control = control;
+	cval->cmask = cmask;
+		
+	
+	/* Create control */
 	kctl = snd_ctl_new1(snd_usb_feature_unit_ctl, cval);
 	if (!kctl) {
 		kfree(cval);
 		return -ENOMEM;
 	}
-
+	
+	/* Set name */
 	snprintf(kctl->id.name, sizeof(kctl->id.name), name);
 	kctl->private_free = usb_mixer_elem_free;
-	return snd_usb_mixer_add_control(mixer, kctl);
+	
+	/* Add control to mixer */
+	int err = snd_usb_mixer_add_control(mixer, kctl);
+	if (err < 0)
+		return err;
+
+	return 0;
 }
 
-static int snd_maudio_ftu_create_mixer(struct usb_mixer_interface *mixer)
+/* Create a volume control for FTU devices*/
+static int snd_maudio_ftu_create_volume_ctls(struct usb_mixer_interface *mixer)
 {
 	char name[64];
-	int in, out, err;
+	unsigned int id, control, cmask;
+	int in, out, err, val_type;
+
+	id = 5;
+	val_type = USB_MIXER_S16;
 
 	for (out = 0; out < 8; out++) {
+		control = out + 1;
 		for (in = 0; in < 8; in++) {
+			cmask = 1 << in;
 			snprintf(name, sizeof(name),
 				 "AIn%d - Out%d Capture Volume", in  + 1, out + 1);
-			err = snd_maudio_ftu_create_ctl(mixer, in, out, name);
+			err = snd_maudio_ftu_create_ctl(mixer, id, control,
+							cmask, val_type, name);
 			if (err < 0)
 				return err;
 		}
-
 		for (in = 8; in < 16; in++) {
+			cmask = 1 << in;
 			snprintf(name, sizeof(name),
 				 "DIn%d - Out%d Playback Volume", in - 7, out + 1);
-			err = snd_maudio_ftu_create_ctl(mixer, in, out, name);
+			err = snd_maudio_ftu_create_ctl(mixer, id, control,
+							cmask, val_type, name);
 			if (err < 0)
 				return err;
 		}
 	}
+	
+	return 0;
+}
+
+static int snd_maudio_ftu_create_effect_volume_ctl(struct usb_mixer_interface *mixer)
+{
+	unsigned int id, control, cmask;
+	int val_type;
+
+	char name[] ="Effect Volume";
+
+	id = 6;
+	val_type = USB_MIXER_U8;
+	control = 2;
+	cmask = 0;
+
+	return snd_maudio_ftu_create_ctl(mixer, id, control, cmask, val_type, name);
+}
+
+
+static int snd_maudio_ftu_create_effect_duration_ctl(struct usb_mixer_interface *mixer)
+{
+	unsigned int id, control, cmask;
+	int val_type;
+
+	char name[] ="Effect Duration";
+
+	id = 6;
+	val_type = USB_MIXER_S16;
+	control = 3;
+	cmask = 0;
+
+	return snd_maudio_ftu_create_ctl(mixer, id, control, cmask, val_type, name);
+}
+
+static int snd_maudio_ftu_create_effect_feedback_ctl(struct usb_mixer_interface *mixer)
+{
+	unsigned int id, control, cmask;
+	int val_type;
+
+	char name[] ="Effect Feedback";
+
+	id = 6;
+	val_type = USB_MIXER_U8;
+	control = 4;
+	cmask = 0;
+
+	return snd_maudio_ftu_create_ctl(mixer, id, control, cmask, val_type, name);
+}
+
+static int snd_maudio_ftu_create_effects_return_ctls(struct usb_mixer_interface *mixer)
+{
+	unsigned int id, control, cmask;
+	int err, val_type, ch;
+	char name[16];
+
+	id = 7;
+	val_type = USB_MIXER_S16;
+	control = 2;
+
+	for (ch = 0; ch < 4; ++ch) {
+		cmask = 1 << ch;
+		snprintf(name, sizeof(name),
+			"Effect Return %d", ch +1);
+		err = snd_maudio_ftu_create_ctl(mixer, id, control, cmask, val_type, name);
+		if (err < 0)
+			return err;
+	}
+
+	return 0;
+}
+
+static int snd_maudio_ftu_create_effects_send_ctls(struct usb_mixer_interface *mixer)
+{
+	unsigned int id, control, cmask;
+	int err, val_type, ch;
+	char name[16];
+
+	id = 5;
+	val_type = USB_MIXER_S16;
+	control = 9;
+
+	for (ch = 0; ch < 8; ++ch) {
+		cmask = 1 << ch;
+		snprintf(name, sizeof(name),
+			"Effect Send AIn%d", ch +1);
+		err = snd_maudio_ftu_create_ctl(mixer, id, control, cmask, val_type, name);
+		if (err < 0)
+			return err;
+	}
+	for (ch = 8; ch < 16; ++ch) {
+		cmask = 1 << ch;
+		snprintf(name, sizeof(name),
+			"Effect Send DIn%d", ch - 7);
+		err = snd_maudio_ftu_create_ctl(mixer, id, control, cmask, val_type, name);
+		if (err < 0)
+			return err;
+	}
+	return 0;
+}
+
+
+static int snd_maudio_ftu_create_mixer(struct usb_mixer_interface *mixer)
+{
+	int err;
+
+	err = snd_maudio_ftu_create_volume_ctls(mixer);
+	if (err < 0)
+		return err;
+	
+	err = snd_maudio_ftu_create_effect_volume_ctl(mixer);
+	if (err < 0)
+		return err;
+
+	err = snd_maudio_ftu_create_effect_duration_ctl(mixer);
+	if (err < 0)
+		return err;
+
+	err = snd_maudio_ftu_create_effect_feedback_ctl(mixer);
+	if (err < 0)
+		return err;
+
+	err = snd_maudio_ftu_create_effects_return_ctls(mixer);
+	if (err < 0)
+		return err;
+
+	err = snd_maudio_ftu_create_effects_send_ctls(mixer);
+	if (err < 0)
+		return err;
 
 	return 0;
 }

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-18 15:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-16 10:38 Fast Track Ultra mixer - opinions anyone? Felix Homann
2012-04-16 11:06 ` Aurélien Leblond
2012-04-16 11:11 ` Grant Diffey
2012-04-16 12:45   ` Felix Homann
2012-04-16 13:10 ` Clemens Ladisch
2012-04-18 11:47 ` Felix Homann
2012-04-18 14:32   ` Felix Homann
2012-04-18 15:02     ` Felix Homann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.