Menu

#1 M-Audio Audiophile USB and other byteswapped devices support

closed-accepted
nobody
None
5
2006-05-04
2005-09-13
No

The patch allows usage of byte swapped devices like the
m-audio audiophile usb with jackd.

The patch is tested with the audiophile usb for
playback and capture as well as with an onboard iec958
playback only device that doesn't require the patch.

Some reasoning why it is not a good idea to point to
plughw: in case of jackd for byte swapped devices:

1. Jackd uses alsa's mmapped I/O for efficiency.
Mmapped I/O bypasses alsa's plug layer so alsa does no
endianess conversion. Thus using a byte swapped device
with jackd is impossible without this patch.

2. If jackd accesses a plug device alsa grants I/O
formats that would be converted by the plug layer.
These formats can differ in physical width from the
actual hw format (e.g. S32_LE for the plug layer when
the actual device accepts only S24_3BE). Mmapped alsa
I/O expects the format as required by the actual device
so there is most probably a format and/or data width
mismatch.

Some hints for m-audio audiophile usb users:

The alsa device layout is a bit strange. Assuming that
the device is card 1, then:

hw:1,0 is iec958 for capture and analogue/headphone for
playback
hw:1,1 is analogue for capture and iec958 for playback

I did never test analogue capture as I don't need it.

To use e.g. capture and playback at 48000Hz sampling
rate on the iec958 interface use a jackd command line
like the following after applying the patch:

jackd -R -P20 -dalsa -r48000 -p64 -n4 -D -Chw:1,0
-Phw:1,1 -i2 -o2

Discussion

  • A. Steinmetz

    A. Steinmetz - 2005-09-13

    patch for jackit 0.100.0

     
  • Martin H

    Martin H - 2005-10-07

    Logged In: YES
    user_id=549673

    This patch makes my Edirol UA-25 work on my Powerbook.
    The UA-25 uses the S24_3LE format, while the powerbook is a
    big endian machine.

     
  • Martin H

    Martin H - 2005-10-14

    Logged In: YES
    user_id=549673

    The S24_3LE format was not working correctly with my UA-25.
    This patch fixes that problem. The "#include" especially
    made a world of difference!

    Sorry for the paste. It seems I cannot attach a file.

    --- memops.c.patched 2005-10-10 23:33:02.000000000 +0100
    +++ memops.c 2005-10-12 18:01:55.000000000 +0100
    @@ -30,6 +30,7 @@
    #include <memory.h>
    #include <stdlib.h>
    #include <limits.h>
    +#include <endian.h>

    #include <jack/memops.h>

    @@ -443,16 +444,22 @@
    x |= (unsigned char)(src[1]);
    x <<= 8;
    x |= (unsigned char)(src[2]);
    - x <<= 8;
    + /* Correct sign bit and the rest of the top
    byte */
    + if (src[0] & 0x80) {
    + x |= 0xff << 24;
    + }
    #elif __BYTE_ORDER == __BIG_ENDIAN
    x = (unsigned char)(src[2]);
    x <<= 8;
    x |= (unsigned char)(src[1]);
    x <<= 8;
    x |= (unsigned char)(src[0]);
    - x <<= 8;
    + /* Correct sign bit and the rest of the top
    byte */
    + if (src[2] & 0x80) {
    + x |= 0xff << 24;
    + }
    #endif
    - *dst = (x >> 8) / SAMPLE_MAX_24BIT;
    + *dst = x / SAMPLE_MAX_24BIT;
    dst++;
    src += src_skip;
    }

     
  • Thibault Le Meur

    Logged In: YES
    user_id=885947

    I confirm that this patch makes my Audiophile USB Work
    with Jack for capture interface. It doesn't break support
    for my internal sound card (VIA8235).

    When will it be integrated into the CVS tree ?

     
  • ronnyt

    ronnyt - 2006-02-07

    Logged In: YES
    user_id=1421669

    I also confirm that this patch makes my Audiophile USB Work
    with Jack for capture and playback interfaces (also analog
    input). It doesn't compromise support for my internal sound
    card (SigmaTel C-major Audio).

    will it be included in the jackd package?

     
  • Paul Davis

    Paul Davis - 2006-05-04
    • status: open --> closed-accepted
     
  • Thibault Le Meur

    Logged In: YES
    user_id=885947

    I'd like to add a very small typo fix which enables 16bits
    mode for Big Endian devices:
    ------------------------------------------------------
    diff -Nru jack.patched.preBE/drivers/alsa/alsa_driver.c
    jack.patched/drivers/alsa/alsa_driver.c
    --- jack.patched.preBE/drivers/alsa/alsa_driver.c
    2006-05-04 19:40:35.000000000 +0200
    +++ jack.patched/drivers/alsa/alsa_driver.c 2006-04-18
    19:53:56.000000000 +0200
    @@ -377,7 +377,7 @@
    {"24bit little", SND_PCM_FORMAT_S24_3LE, IS_LE},
    {"24bit big", SND_PCM_FORMAT_S24_3BE, IS_BE},
    {"16bit little", SND_PCM_FORMAT_S16_LE, IS_LE},
    - {"16bit big", SND_PCM_FORMAT_S16_LE, IS_BE},
    + {"16bit big", SND_PCM_FORMAT_S16_BE, IS_BE},
    };
    #define NOFORMATS (sizeof(formats)/sizeof(formats[0]))
    ------------------------------------------------------

    I've seen that the ticket has been Closed with resolution
    Accepted, but I cannot see any change in the CVS tree: may
    be tomorrow...

     

Log in to post a comment.