All of lore.kernel.org
 help / color / mirror / Atom feed
* Audiophile USB samplerate workaround
@ 2003-07-23  6:59 Ben Saylor
  2003-07-23  8:29 ` Takashi Iwai
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Saylor @ 2003-07-23  6:59 UTC (permalink / raw)
  To: alsa-devel

I did some investigation to find out why the sample rate can't be set to 
anything but 48khz (or rather, remains 48khz even if it is set to 
something else) on the Audiophile.

In init_usb_sample_rate(), 
	if (fmt->attributes & EP_CS_ATTR_SAMPLE_RATE)
is never true, so the sample rate is not set.  If I just make it if(1) 
the sample rate is settable.  Is this a hardware bug or something else?

Ben



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0

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

* Re: Audiophile USB samplerate workaround
  2003-07-23  6:59 Audiophile USB samplerate workaround Ben Saylor
@ 2003-07-23  8:29 ` Takashi Iwai
  2003-07-23  9:02   ` Ben Saylor
  0 siblings, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2003-07-23  8:29 UTC (permalink / raw)
  To: Ben Saylor; +Cc: alsa-devel

At Tue, 22 Jul 2003 22:59:25 -0800,
Ben Saylor wrote:
> 
> I did some investigation to find out why the sample rate can't be set to 
> anything but 48khz (or rather, remains 48khz even if it is set to 
> something else) on the Audiophile.
 
does format descriptor contain other sample rates?

> In init_usb_sample_rate(), 
> 	if (fmt->attributes & EP_CS_ATTR_SAMPLE_RATE)
> is never true, so the sample rate is not set.  If I just make it if(1) 
> the sample rate is settable.  Is this a hardware bug or something else?

then the format descriptor might be bogus.


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0

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

* Re: Audiophile USB samplerate workaround
  2003-07-23  8:29 ` Takashi Iwai
@ 2003-07-23  9:02   ` Ben Saylor
  2003-07-23  9:33     ` Takashi Iwai
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Saylor @ 2003-07-23  9:02 UTC (permalink / raw)
  To: alsa-devel

On Wednesday 23 July 2003 12:29 am, you wrote:
> At Tue, 22 Jul 2003 22:59:25 -0800,
>
> Ben Saylor wrote:
> > I did some investigation to find out why the sample rate can't be
> > set to anything but 48khz (or rather, remains 48khz even if it is
> > set to something else) on the Audiophile.
>
> does format descriptor contain other sample rates?

In parse_audio_format_rates(), nr_rates is always 0 (continuous).  
/proc/asound/card0/stream{0,1} reflect the same.  Most of the altsets 
are 8000-48000 continuous.  I hope that's a meaningful answer. :)

> > In init_usb_sample_rate(),
> > 	if (fmt->attributes & EP_CS_ATTR_SAMPLE_RATE)
> > is never true, so the sample rate is not set.  If I just make it
> > if(1) the sample rate is settable.  Is this a hardware bug or
> > something else?
>
> then the format descriptor might be bogus.
>
>
> Takashi



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0

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

* Re: Audiophile USB samplerate workaround
  2003-07-23  9:02   ` Ben Saylor
@ 2003-07-23  9:33     ` Takashi Iwai
  2003-07-23 10:05       ` Ben Saylor
  0 siblings, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2003-07-23  9:33 UTC (permalink / raw)
  To: Ben Saylor; +Cc: alsa-devel

At Wed, 23 Jul 2003 01:02:19 -0800,
Ben Saylor wrote:
> 
> On Wednesday 23 July 2003 12:29 am, you wrote:
> > At Tue, 22 Jul 2003 22:59:25 -0800,
> >
> > Ben Saylor wrote:
> > > I did some investigation to find out why the sample rate can't be
> > > set to anything but 48khz (or rather, remains 48khz even if it is
> > > set to something else) on the Audiophile.
> >
> > does format descriptor contain other sample rates?
> 
> In parse_audio_format_rates(), nr_rates is always 0 (continuous).  
> /proc/asound/card0/stream{0,1} reflect the same.  Most of the altsets 
> are 8000-48000 continuous.  I hope that's a meaningful answer. :)

ok, then it supports other sample rates :)

about the symptom: do you mean that the playback gets too fast with
the lower sample rate, or the driver doesn't accept anything else 48k?


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0

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

* Re: Audiophile USB samplerate workaround
  2003-07-23  9:33     ` Takashi Iwai
@ 2003-07-23 10:05       ` Ben Saylor
  2003-07-23 10:17         ` Takashi Iwai
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Saylor @ 2003-07-23 10:05 UTC (permalink / raw)
  To: alsa-devel

> ok, then it supports other sample rates :)
>
> about the symptom: do you mean that the playback gets too fast with
> the lower sample rate,

Yes.  i.e. it will play a 44100 hz or whatever stream, but playback is 
too fast.

> or the driver doesn't accept anything else
> 48k?
>
>
> Takashi



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0

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

* Re: Audiophile USB samplerate workaround
  2003-07-23 10:05       ` Ben Saylor
@ 2003-07-23 10:17         ` Takashi Iwai
  2003-07-23 21:14           ` Ben Saylor
  0 siblings, 1 reply; 8+ messages in thread
From: Takashi Iwai @ 2003-07-23 10:17 UTC (permalink / raw)
  To: Ben Saylor; +Cc: alsa-devel

At Wed, 23 Jul 2003 02:05:50 -0800,
Ben Saylor wrote:
> 
> > ok, then it supports other sample rates :)
> >
> > about the symptom: do you mean that the playback gets too fast with
> > the lower sample rate,
> 
> Yes.  i.e. it will play a 44100 hz or whatever stream, but playback is 
> too fast.

so apparently we need some workaround (as found below line 2291 of
usbaudio.c).
please try to check the product and vendor id and set
	fp->attribtes |= EP_CS_ATTR_SAMPLERATE
with that condition.
if it works, please give me the patch.


thanks,

Takashi


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0

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

* Re: Audiophile USB samplerate workaround
  2003-07-23 10:17         ` Takashi Iwai
@ 2003-07-23 21:14           ` Ben Saylor
  2003-07-24 13:04             ` Takashi Iwai
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Saylor @ 2003-07-23 21:14 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

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

That does the trick.  Here's a patch against 0.9.5.

I don't know if this is related, but one thing I've been puzzling over 
is that half the time after I plug in the audiophile I get static 
instead of sound.  I have to unload alsa and plug it in again.  (As I 
mentioned before, I always get static if I load the alsa modules 
explicitly).

Ben

On Wednesday 23 July 2003 2:17 am, Takashi Iwai wrote:
> At Wed, 23 Jul 2003 02:05:50 -0800,
>
> Ben Saylor wrote:
> > > ok, then it supports other sample rates :)
> > >
> > > about the symptom: do you mean that the playback gets too fast
> > > with the lower sample rate,
> >
> > Yes.  i.e. it will play a 44100 hz or whatever stream, but playback
> > is too fast.
>
> so apparently we need some workaround (as found below line 2291 of
> usbaudio.c).
> please try to check the product and vendor id and set
> 	fp->attribtes |= EP_CS_ATTR_SAMPLERATE
> with that condition.
> if it works, please give me the patch.
>
>
> thanks,
>
> Takashi

[-- Attachment #2: audiophile1.diff --]
[-- Type: text/x-diff, Size: 1630 bytes --]

--- alsa-driver-0.9.5/alsa-kernel/usb/usbaudio.c	2003-06-23 04:41:36.000000000 -0800
+++ alsa-driver-0.9.5-brs/alsa-kernel/usb/usbaudio.c	2003-07-23 12:53:19.000000000 -0800
@@ -2295,6 +2295,14 @@
 			 */
 			fp->attributes &= ~EP_CS_ATTR_SAMPLE_RATE;
 		}
+
+		/* workaround for M-Audio Audiophile USB */
+		if (dev->descriptor.idVendor == 0x0763 &&
+		    dev->descriptor.idProduct == 0x2003) {
+			/* doesn't set the sample rate attribute, but supports it */
+			fp->attributes |= EP_CS_ATTR_SAMPLE_RATE;
+		}
+
 		/*
 		 * plantronics headset and Griffin iMic have set adaptive-in
 		 * although it's really not...
@@ -2695,11 +2703,6 @@
 	if (quirk && quirk->ifnum != QUIRK_ANY_INTERFACE && ifnum != quirk->ifnum)
 		goto __err_val;
 
-	if (usb_set_configuration(dev, get_cfg_desc(config)->bConfigurationValue) < 0) {
-		snd_printk(KERN_ERR "cannot set configuration (value 0x%x)\n", get_cfg_desc(config)->bConfigurationValue);
-		goto __err_val;
-	}
-
 	/* SB Extigy needs special boot-up sequence */
 	/* if more models come, this will go to the quirk list. */
 	if (dev->descriptor.idVendor == 0x041e && dev->descriptor.idProduct == 0x3000) {
@@ -2729,6 +2732,11 @@
 		/* it's a fresh one.
 		 * now look for an empty slot and create a new card instance
 		 */
+		if (usb_set_configuration(dev, get_cfg_desc(config)->bConfigurationValue) < 0) {
+			snd_printk(KERN_ERR "cannot set configuration (value 0x%x)\n", get_cfg_desc(config)->bConfigurationValue);
+			goto __err_val;
+		}
+
 		for (i = 0; i < SNDRV_CARDS; i++)
 			if (enable[i] && ! usb_chip[i] &&
 			    (vid[i] == -1 || vid[i] == dev->descriptor.idVendor) &&

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

* Re: Audiophile USB samplerate workaround
  2003-07-23 21:14           ` Ben Saylor
@ 2003-07-24 13:04             ` Takashi Iwai
  0 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2003-07-24 13:04 UTC (permalink / raw)
  To: Ben Saylor; +Cc: alsa-devel

At Wed, 23 Jul 2003 13:14:03 -0800,
Ben Saylor wrote:
> 
> [1  <text/plain; iso-8859-1 (7bit)>]
> That does the trick.  Here's a patch against 0.9.5.

thanks for the patch.
i applied to cvs.


> I don't know if this is related, but one thing I've been puzzling over 
> is that half the time after I plug in the audiophile I get static 
> instead of sound.  I have to unload alsa and plug it in again.  (As I 
> mentioned before, I always get static if I load the alsa modules 
> explicitly).

i don't know exactly what is the cause here, too...


Takashi


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01

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

end of thread, other threads:[~2003-07-24 13:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-23  6:59 Audiophile USB samplerate workaround Ben Saylor
2003-07-23  8:29 ` Takashi Iwai
2003-07-23  9:02   ` Ben Saylor
2003-07-23  9:33     ` Takashi Iwai
2003-07-23 10:05       ` Ben Saylor
2003-07-23 10:17         ` Takashi Iwai
2003-07-23 21:14           ` Ben Saylor
2003-07-24 13:04             ` Takashi Iwai

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.