* quattro usb-audio endianess conversion layer @ 2004-06-09 19:50 Patrick Shirkey 2004-06-10 17:04 ` Clemens Ladisch 0 siblings, 1 reply; 4+ messages in thread From: Patrick Shirkey @ 2004-06-09 19:50 UTC (permalink / raw) To: alsa-devel Has anyone had ideas on how to implement a layer that works to automatically convert the quattros big endian input into little endian to enable ease of use with most Linux audio apps? It turns out the reason for the noise in the input channels all this time is due to the quattro only reading big endian at input. Conversely it only accepts little endian for output :( This has got to be one of the most annoying workarounds in the history of ALSA audio drivers. -- Patrick Shirkey - Boost Hardware Ltd. Http://www.boosthardware.com Http://www.djcj.org/LAU/guide/ - The Linux Audio Users guide Http://www.djcj.org/gigs/ - Gigs guide Korea Http://www.nana7.net - Bar Nana - Itaewon, Seoul, Sth Corea ======================================== Apparently upon the beginning of the barrage, the donkey broke discipline and panicked, toppling the cart. At that point, the rockets disconnected from the timer, leaving them strewn around the street. Tethered to the now toppled cart, the donkey was unable to escape before the arrival of U.S. troops. United Press International Rockets on donkeys hit major Baghdad sites By P. MITCHELL PROTHERO Published 11/21/2003 11:13 AM ------------------------------------------------------- This SF.Net email is sponsored by: GNOME Foundation Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event. GNOME Users and Developers European Conference, 28-30th June in Norway http://2004/guadec.org ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: quattro usb-audio endianess conversion layer 2004-06-09 19:50 quattro usb-audio endianess conversion layer Patrick Shirkey @ 2004-06-10 17:04 ` Clemens Ladisch 2004-06-14 15:38 ` Patrick Shirkey 0 siblings, 1 reply; 4+ messages in thread From: Clemens Ladisch @ 2004-06-10 17:04 UTC (permalink / raw) To: Patrick Shirkey; +Cc: alsa-devel Patrick Shirkey wrote: > It turns out the reason for the noise in the input channels all this > time is due to the quattro only reading big endian at input. Does this happen all of the time? There is a bug report which says that it works sometimes. > Has anyone had ideas on how to implement a layer that works to > automatically convert the quattros big endian input into little endian > to enable ease of use with most Linux audio apps? With the patch below, it should work with plughw:X. Does it? HTH Clemens -- Index: alsa-kernel/usb/usbaudio.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/usb/usbaudio.c,v retrieving revision 1.100 diff -u -r1.100 usbaudio.c --- alsa-kernel/usb/usbaudio.c 5 May 2004 08:50:45 -0000 1.100 +++ alsa-kernel/usb/usbaudio.c 10 Jun 2004 17:00:40 -0000 @@ -2182,6 +2182,24 @@ /* + * check if the device uses big-endian samples + */ +static int is_big_endian_format(struct usb_device *dev, struct audioformat *fp) +{ + /* M-Audio */ + if (dev->descriptor.idVendor == 0x0763) { + /* Quattro: captured data only */ + if (dev->descriptor.idProduct == 0x2001 && + fp->endpoint & USB_DIR_IN) + return 1; + /* Audiophile USB */ + if (dev->descriptor.idProduct == 0x2003) + return 1; + } + return 0; +} + +/* * parse the audio format type I descriptor * and returns the corresponding pcm format * @@ -2217,17 +2235,13 @@ pcm_format = SNDRV_PCM_FORMAT_S8; break; case 2: - /* M-Audio audiophile USB workaround */ - if (dev->descriptor.idVendor == 0x0763 && - dev->descriptor.idProduct == 0x2003) + if (is_big_endian_format(dev, fp)) pcm_format = SNDRV_PCM_FORMAT_S16_BE; /* grrr, big endian!! */ else pcm_format = SNDRV_PCM_FORMAT_S16_LE; break; case 3: - /* M-Audio audiophile USB workaround */ - if (dev->descriptor.idVendor == 0x0763 && - dev->descriptor.idProduct == 0x2003) + if (is_big_endian_format(dev, fp)) pcm_format = SNDRV_PCM_FORMAT_S24_3BE; /* grrr, big endian!! */ else pcm_format = SNDRV_PCM_FORMAT_S24_3LE; Index: alsa-kernel/usb/usbquirks.h =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/usb/usbquirks.h,v retrieving revision 1.33 diff -u -r1.33 usbquirks.h --- alsa-kernel/usb/usbquirks.h 12 May 2004 06:29:22 -0000 1.33 +++ alsa-kernel/usb/usbquirks.h 10 Jun 2004 17:00:40 -0000 @@ -830,11 +830,42 @@ .driver_info = (unsigned long) & (const snd_usb_audio_quirk_t) { .vendor_name = "M-Audio", .product_name = "Quattro", - .ifnum = 9, - .type = QUIRK_MIDI_MIDIMAN, - .data = & (const snd_usb_midi_endpoint_info_t) { - .out_cables = 0x0001, - .in_cables = 0x0001 + .ifnum = QUIRK_ANY_INTERFACE, + .type = QUIRK_COMPOSITE, + .data = & (const snd_usb_audio_quirk_t[]) { + /* + * Interfaces 0-2 are "Windows-compatible", 16-bit only, + * and share endpoints with the other interfaces. + * Ignore them. The other interfaces can do 24 bits, + * but captured samples are big-endian (see usbaudio.c). + */ + { + .ifnum = 4, + .type = QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum = 5, + .type = QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum = 7, + .type = QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum = 8, + .type = QUIRK_AUDIO_STANDARD_INTERFACE + }, + { + .ifnum = 9, + .type = QUIRK_MIDI_MIDIMAN, + .data = & (const snd_usb_midi_endpoint_info_t) { + .out_cables = 0x0001, + .in_cables = 0x0001 + } + }, + { + .ifnum = -1 + } } } }, ------------------------------------------------------- This SF.Net email is sponsored by the new InstallShield X. >From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: quattro usb-audio endianess conversion layer 2004-06-10 17:04 ` Clemens Ladisch @ 2004-06-14 15:38 ` Patrick Shirkey 2004-06-14 17:14 ` Clemens Ladisch 0 siblings, 1 reply; 4+ messages in thread From: Patrick Shirkey @ 2004-06-14 15:38 UTC (permalink / raw) To: Clemens Ladisch; +Cc: alsa-devel Clemens Ladisch wrote: > Patrick Shirkey wrote: > >>It turns out the reason for the noise in the input channels all this >>time is due to the quattro only reading big endian at input. > > > Does this happen all of the time? There is a bug report which says > that it works sometimes. > > >>Has anyone had ideas on how to implement a layer that works to >>automatically convert the quattros big endian input into little endian >>to enable ease of use with most Linux audio apps? > > > With the patch below, it should work with plughw:X. Does it? > Thanks Clemens. I finally was able to test the patch and my first impression is that it has made a significant difference and should be committed immediately. I recorded with arecord -f cd -d 10 -D plughw:2,0 test.wav played back with aplay -f cd -d hw:2,1 test.wav The sound is much clearer. My next question is: Does anyone have a good idea how to apply this to a jack setup without sacrificing latency? -- Patrick Shirkey - Boost Hardware Ltd. Http://www.boosthardware.com Http://www.djcj.org/LAU/guide/ - The Linux Audio Users guide Http://www.djcj.org/gigs/ - Gigs guide Korea Http://www.nana7.net - Bar Nana - Itaewon, Seoul, Sth Corea ======================================== Apparently upon the beginning of the barrage, the donkey broke discipline and panicked, toppling the cart. At that point, the rockets disconnected from the timer, leaving them strewn around the street. Tethered to the now toppled cart, the donkey was unable to escape before the arrival of U.S. troops. United Press International Rockets on donkeys hit major Baghdad sites By P. MITCHELL PROTHERO Published 11/21/2003 11:13 AM ------------------------------------------------------- This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: quattro usb-audio endianess conversion layer 2004-06-14 15:38 ` Patrick Shirkey @ 2004-06-14 17:14 ` Clemens Ladisch 0 siblings, 0 replies; 4+ messages in thread From: Clemens Ladisch @ 2004-06-14 17:14 UTC (permalink / raw) To: Patrick Shirkey; +Cc: alsa-devel Patrick Shirkey wrote: > > Patrick Shirkey wrote: > > > >>It turns out the reason for the noise in the input channels all this > >>time is due to the quattro only reading big endian at input. > > I finally was able to test the patch and my first impression is that it > has made a significant difference Good. > My next question is: Does anyone have a good idea how to apply this to a > jack setup without sacrificing latency? By adding non-native endianness support to Jack. (Which requires supporting different sample formats for playback vs. recording.) Regards, Clemens ------------------------------------------------------- This SF.Net email is sponsored by the new InstallShield X. >From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-06-14 17:14 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-06-09 19:50 quattro usb-audio endianess conversion layer Patrick Shirkey 2004-06-10 17:04 ` Clemens Ladisch 2004-06-14 15:38 ` Patrick Shirkey 2004-06-14 17:14 ` Clemens Ladisch
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.