Skip to contentSkip to conversation

snd-usb-audio and audiophile usb analog capture

RFC PATCH Thibault LE MEUR 2 participants 4 messages Mar 13, 2006 – Mar 14, 2006

lore
Share & tools
lore
#0 lore raw

Hi,

Here is the new patch for the Audiophile usb device.

You'll find in this mail:
* the modifications applied to the patch
* a test report from another audiophile usb user

List of modifications since last patch:

Quoted 3 lines
Quoted 3 lines

Could you include it in the patch as a document put in Documentation directory? Also don't forget to update ALSA-Configuration.txt when an option is added/modified.

* ALSA-Configuration.txt modified
* Audiophile-USB.txt new documentation file

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+static int device_setup = 0x00; /* device specific setup

You don't need zero-initialization here. A static variable is guaranteed to be zero-initialized.

* zero-initialization removed.

Quoted 1 line
Quoted 1 line

Also, try not to exeed 80 columns in general :)

* I tried to limit the columns on comments

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+int audiophile_skip_setting_quirk(int iface, int altno);

Please make it a static function.

* Done.

Quoted 2 lines
Quoted 2 lines

Put continue to the next line.
Put return to the next line (in other places, too).

* Done.

Moreover, I received a test report and comments by Sander van Grieken (man thanks for that):

Quoted 61 lines

REGRESSION TEST (loading usbaudio module without options)
---------------------------------------------------------

https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1631

* trying signal from jack input connectors
* arecord -D plughw:0,1 -t wav -c 2 -r 96000 -f S16_LE -d 2 -vv test.wav

(plug conversion to 16 bits, real capture is done in 24 bits)

Slave: Hardware PCM card 1 'Audiophile USB (tm)' device 1 subdevice 0 Its setup is:

  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S24_3BE
  subformat    : STD
  channels     : 2
  rate         : 96000
  exact rate   : 96000 (96000/1)
  msbits       : 24
  buffer_size  : 48000
  period_size  : 12000
  period_time  : 125000
  tick_time    : 4000
  tstamp_mode  : NONE
  period_step  : 1
  sleep_min    : 0
  avail_min    : 12000
  xfer_align   : 12000

start_threshold : 1
stop_threshold : 48000
silence_threshold: 0
silence_size : 0
boundary : 1572864000

* trying signal from jack input connectors
* arecord -D plughw:0,1 -t wav -c 2 -r 96000 -f S32_LE -d 2 -vv test.wav

(same as above, without the plug conversion)

Slave: Hardware PCM card 1 'Audiophile USB (tm)' device 1 subdevice 0 Its setup is:

  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S24_3BE
  subformat    : STD
  channels     : 2
  rate         : 96000
  exact rate   : 96000 (96000/1)
  msbits       : 24
  buffer_size  : 48000
  period_size  : 12000
  period_time  : 125000
  tick_time    : 4000
  tstamp_mode  : NONE
  period_step  : 1
  sleep_min    : 0
  avail_min    : 12000
  xfer_align   : 12000
Quoted 7 lines

start_threshold : 1
stop_threshold : 48000
silence_threshold: 0
silence_size : 0
boundary : 1572864000

*** conclusion: no regressions.

==> Will ensure backward compatibility.

Quoted 15 lines

MODES TEST
----------

* device_setup=0x05

expected: 16bit, 48001-96000Hz should work. instead samples are 24bit (even
though b3 is set to '0'):

working:
arecord -D hw:1,1 -t raw -c 2 -r 96000 -f S24_3BE -d 2 -vv test.raw

your claim '8000-96000 sampling rate' is incorrect:

Quoted 8 lines

any rate below 48001 will be forced to 48001
Recording raw data 'test.raw' : Signed 24 bit Big Endian in 3bytes, Rate 24000
Hz, Stereo
Warning: rate is not accurate (requested = 24000Hz, got = 48001Hz)
please, try the plug plugin (-Dplug:hw:1,1)

seems like setting b2 implies b3=1

==> Exact, I've modified the docs to be more accurate about available setup modes.

Quoted 10 lines

* device_setup=0x09

works as expected:
arecord -D hw:1,1 -t raw -c 2 -r 48000 -f S24_3BE -d 2 -vv test.raw arecord -D hw:1,1 -t raw -c 2 -r 44100 -f S24_3BE -d 2 -vv test.raw arecord -D hw:1,1 -t raw -c 2 -r 8000 -f S24_3BE -d 2 -vv test.raw

Quoted 7 lines

every sample rate 8000-48000 works.

* device_setup=0x01

works as expected:
arecord -D hw:1,1 -t raw -c 2 -r 48000 -f S16_BE -d 2 -vv test.raw every sample rate 8000-48000 works.

alsa-kernel/Documentation/ALSA-Configuration.txt +3 -0
diff -Nru alsa-cvs-02282006.orig/alsa-kernel/Documentation/ALSA-Configuration.txt alsa-cvs-02282006/alsa-kernel/Documentation/ALSA-Configuration.txt
@@ -1372,6 +1372,9 @@
 
     vid             - Vendor ID for the device (optional)
     pid             - Product ID for the device (optional)
+    device_setup    - Device specific magic number (optional)
+                    - Influence depends on the device
+                    - Default: 0x0000 
 
     This module supports multiple devices, autoprobe and hotplugging.
 
alsa-kernel/Documentation/Audiophile-Usb.txt +330 -0

330 lines not on this page · raw message

alsa-driver/usb/usbaudio.c +45 -1

82 lines not on this page · raw message

#1 lore raw

At Mon, 13 Mar 2006 11:34:40 +0100,

Quoted 10 lines · Thibault LE MEUR

Hi,

Here is the new patch for the Audiophile usb device.

You'll find in this mail:
* the modifications applied to the patch
* a test report from another audiophile usb user

Quoted 7 lines

List of modifications since last patch:

Quoted 3 lines
Quoted 3 lines

Could you include it in the patch as a document put in Documentation directory? Also don't forget to update ALSA-Configuration.txt when an option is added/modified.

* ALSA-Configuration.txt modified
* Audiophile-USB.txt new documentation file

Could you remove non-ASCII characters as much as possible?

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+static int device_setup = 0x00; /* device specific setup

You don't need zero-initialization here. A static variable is guaranteed to be zero-initialized.

* zero-initialization removed.

Quoted 1 line
Quoted 1 line

Also, try not to exeed 80 columns in general :)

Quoted 7 lines

* I tried to limit the columns on comments

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

+int audiophile_skip_setting_quirk(int iface, int altno);

Please make it a static function.

* Done.

static is missing still in the definition part.

  +int audiophile_skip_setting_quirk(int iface, int altno) {

Also, put the brace to the next line.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

Put continue to the next line.
Put return to the next line (in other places, too).

* Done.

One more thing:

The device_setup should be an array because usb-audio driver can have multiple instances. Use device_setup[chip->index] instead.

Also, submit with a proper changelog of the patch and a signed-off-by line for merging.

Please fix them up, and I'll merge the new patch soon.

Thanks,

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

#2 lore raw

Hi Takashi,

Quoted 1 line

Could you remove non-ASCII characters as much as possible?

Of course, shame on me... I didn't see them, I hope there are none left...

Quoted 5 lines

static is missing still in the definition part.

  +int audiophile_skip_setting_quirk(int iface, int altno) {

Also, put the brace to the next line.

Done.

Quoted 4 lines

One more thing:

The device_setup should be an array because usb-audio driver can have multiple instances. Use device_setup[chip->index] instead.

Ok, I've patched this in the following way:

* device_setup is a static array
However, since this is not a "static int" anymore, do I have to initialize the value to 0x00 (currently not) or is it automatically zero-initialized in case of static int arrays?

* I've modified the quirk to have the "chip" as the first parameter, and to be able to use device_setup[chip->index] instead

Quoted 2 lines

Also, submit with a proper changelog of the patch and a signed-off-by line for merging.

Summary: Fixes audiophile usb analog capture with the new device_setup parameter.

The patch adds the "device_setup" module parameter and a specific quirk to correctly
initialize the audiophile usb device: this fixes the distorted sound bug on the
Analog capture port. Backward compatibility is achieved by simply omitting the new parameter.

Quoted 1 line

Please fix them up, and I'll merge the new patch soon.

Thanks for your help and work,
Thibault

alsa-kernel/Documentation/ALSA-Configuration.txt +3 -0
diff -Nru alsa-cvs-02282006.orig/alsa-kernel/Documentation/ALSA-Configuration.txt alsa-cvs-02282006/alsa-kernel/Documentation/ALSA-Configuration.txt
@@ -1372,6 +1372,9 @@
 
     vid             - Vendor ID for the device (optional)
     pid             - Product ID for the device (optional)
+    device_setup    - Device specific magic number (optional)
+                    - Influence depends on the device
+                    - Default: 0x0000 
 
     This module supports multiple devices, autoprobe and hotplugging.
 
alsa-kernel/Documentation/Audiophile-Usb.txt +330 -0

330 lines not on this page · raw message

alsa-driver/usb/usbaudio.c +46 -1

83 lines not on this page · raw message

#3 lore raw

At Tue, 14 Mar 2006 11:31:29 +0100,

Quoted 37 lines · Thibault LE MEUR

Hi Takashi,

Quoted 1 line

Could you remove non-ASCII characters as much as possible?

Of course, shame on me... I didn't see them, I hope there are none left...

Quoted 5 lines

static is missing still in the definition part.

  +int audiophile_skip_setting_quirk(int iface, int altno) {

Also, put the brace to the next line.

Done.

Quoted 4 lines

One more thing:

The device_setup should be an array because usb-audio driver can have multiple instances. Use device_setup[chip->index] instead.

Ok, I've patched this in the following way:

* device_setup is a static array
However, since this is not a "static int" anymore, do I have to initialize the value to 0x00 (currently not) or is it automatically zero-initialized in case of static int arrays?

* I've modified the quirk to have the "chip" as the first parameter, and to be able to use device_setup[chip->index] instead

Quoted 2 lines

Also, submit with a proper changelog of the patch and a signed-off-by line for merging.

Summary: Fixes audiophile usb analog capture with the new device_setup parameter.

Quoted 8 lines

The patch adds the "device_setup" module parameter and a specific quirk to correctly
initialize the audiophile usb device: this fixes the distorted sound bug on the
Analog capture port. Backward compatibility is achieved by simply omitting the new parameter.

OK, applied to CVS now. I modified white spaces a little bit, but essentially it's identical with yours.

Thanks!

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642