Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) ========================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) Guide to using M-Audio Audiophile USB with ALSA and Jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ========================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) v1.5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) Thibault Le Meur <Thibault.LeMeur@supelec.fr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) This document is a guide to using the M-Audio Audiophile USB (tm) device with 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) ALSA and JACK.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) History
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) =======
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) * v1.4 - Thibault Le Meur (2007-07-11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)   - Added Low Endianness nature of 16bits-modes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)     found by Hakan Lennestal <Hakan.Lennestal@brfsodrahamn.se>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)   - Modifying document structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) * v1.5 - Thibault Le Meur (2007-07-12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)   - Added AC3/DTS passthru info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) Audiophile USB Specs and correct usage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) ======================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) This part is a reminder of important facts about the functions and limitations 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) of the device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) The device has 4 audio interfaces, and 2 MIDI ports:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * Analog Stereo Input (Ai)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)    - This port supports 2 pairs of line-level audio inputs (1/4" TS and RCA) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)    - When the 1/4" TS (jack) connectors are connected, the RCA connectors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)      are disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * Analog Stereo Output (Ao)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * Digital Stereo Input (Di)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * Digital Stereo Output (Do)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * Midi In (Mi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * Midi Out (Mo)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) The internal DAC/ADC has the following characteristics:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) * sample depth of 16 or 24 bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) * sample rate from 8kHz to 96kHz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) * Two interfaces can't use different sample depths at the same time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) Moreover, the Audiophile USB documentation gives the following Warning:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)   Please exit any audio application running before switching between bit depths
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) Due to the USB 1.1 bandwidth limitation, a limited number of interfaces can be 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) activated at the same time depending on the audio mode selected:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * 16-bit/48kHz ==> 4 channels in + 4 channels out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)    - Ai+Ao+Di+Do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * 24-bit/48kHz ==> 4 channels in + 2 channels out, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)    or 2 channels in + 4 channels out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)    - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * 24-bit/96kHz ==> 2 channels in _or_ 2 channels out (half duplex only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)    - Ai or Ao or Di or Do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) Important facts about the Digital interface:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) --------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)  * The Do port additionally supports surround-encoded AC-3 and DTS passthrough, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)    though I haven't tested it under Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)    - Note that in this setup only the Do interface can be enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)  * Apart from recording an audio digital stream, enabling the Di port is a way 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)    to synchronize the device to an external sample clock
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81)    - As a consequence, the Di port must be enable only if an active Digital 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)      source is connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)    - Enabling Di when no digital source is connected can result in a 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)      synchronization error (for instance sound played at an odd sample rate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) Audiophile USB MIDI support in ALSA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) ===================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) The Audiophile USB MIDI ports will be automatically supported once the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) following modules have been loaded:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  * snd-usb-audio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * snd-seq-midi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) No additional setting is required.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) Audiophile USB Audio support in ALSA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) Audio functions of the Audiophile USB device are handled by the snd-usb-audio 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) module. This module can work in a default mode (without any device-specific 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) parameter), or in an "advanced" mode with the device-specific parameter called 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) ``device_setup``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) Default Alsa driver mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) ------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) The default behavior of the snd-usb-audio driver is to list the device 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) capabilities at startup and activate the required mode when required 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) by the applications: for instance if the user is recording in a 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 24bit-depth-mode and immediately after wants to switch to a 16bit-depth mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) the snd-usb-audio module will reconfigure the device on the fly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) This approach has the advantage to let the driver automatically switch from sample 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) rates/depths automatically according to the user's needs. However, those who 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) are using the device under windows know that this is not how the device is meant to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) work: under windows applications must be closed before using the m-audio control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) panel to switch the device working mode. Thus as we'll see in next section, this 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) Default Alsa driver mode can lead to device misconfigurations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) Let's get back to the Default Alsa driver mode for now.  In this case the 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) Audiophile interfaces are mapped to alsa pcm devices in the following 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) way (I suppose the device's index is 1):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  * hw:1,0 is Ao in playback and Di in capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  * hw:1,1 is Do in playback and Ai in capture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)  * hw:1,2 is Do in AC3/DTS passthrough mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) In this mode, the device uses Big Endian byte-encoding so that 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) supported audio format are S16_BE for 16-bit depth modes and S24_3BE for 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 24-bits depth mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) One exception is the hw:1,2 port which was reported to be Little Endian 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) compliant (supposedly supporting S16_LE) but processes in fact only S16_BE streams.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) This has been fixed in kernel 2.6.23 and above and now the hw:1,2 interface 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) is reported to be big endian in this default driver mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) Examples:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  * playing a S24_3BE encoded raw file to the Ao port::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)    % aplay -D hw:1,0 -c2 -t raw -r48000 -fS24_3BE test.raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * recording a  S24_3BE encoded raw file from the Ai port::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)    % arecord -D hw:1,1 -c2  -t raw -r48000 -fS24_3BE test.raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  * playing a S16_BE encoded raw file to the Do port::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)    % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  * playing an ac3 sample file to the Do port::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)    % aplay -D hw:1,2 --channels=6 ac3_S16_BE_encoded_file.raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) If you're happy with the default Alsa driver mode and don't experience any 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) issue with this mode, then you can skip the following chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) Advanced module setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ---------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) Due to the hardware constraints described above, the device initialization made 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) by the Alsa driver in default mode may result in a corrupted state of the 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) device. For instance, a particularly annoying issue is that the sound captured 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) from the Ai interface sounds distorted (as if boosted with an excessive high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) volume gain).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) For people having this problem, the snd-usb-audio module has a new module 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) parameter called ``device_setup`` (this parameter was introduced in kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) release 2.6.17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) Initializing the working mode of the Audiophile USB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) As far as the Audiophile USB device is concerned, this value let the user 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) specify:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)  * the sample depth
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)  * the sample rate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)  * whether the Di port is used or not 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) When initialized with ``device_setup=0x00``, the snd-usb-audio module has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) the same behaviour as when the parameter is omitted (see paragraph "Default 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) Alsa driver mode" above)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) Others modes are described in the following subsections.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 16-bit modes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) ~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) The two supported modes are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)  * ``device_setup=0x01``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)    - 16bits 48kHz mode with Di disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)    - Ai,Ao,Do can be used at the same time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)    - hw:1,0 is not available in capture mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)    - hw:1,2 is not available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)  * ``device_setup=0x11``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)    - 16bits 48kHz mode with Di enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)    - Ai,Ao,Di,Do can be used at the same time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)    - hw:1,0 is available in capture mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)    - hw:1,2 is not available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) In this modes the device operates only at 16bits-modes. Before kernel 2.6.23,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) the devices where reported to be Big-Endian when in fact they were Little-Endian
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) so that playing a file was a matter of using:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)    % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test_S16_LE.raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) where "test_S16_LE.raw" was in fact a little-endian sample file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) Thanks to Hakan Lennestal (who discovered the Little-Endiannes of the device in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) these modes) a fix has been committed (expected in kernel 2.6.23) and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) Alsa now reports Little-Endian interfaces. Thus playing a file now is as simple as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) using:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)    % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_LE test_S16_LE.raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 24-bit modes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) ~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) The three supported modes are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * ``device_setup=0x09``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)    - 24bits 48kHz mode with Di disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)    - Ai,Ao,Do can be used at the same time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)    - hw:1,0 is not available in capture mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)    - hw:1,2 is not available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  * ``device_setup=0x19``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)    - 24bits 48kHz mode with Di enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)    - 3 ports from {Ai,Ao,Di,Do} can be used at the same time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)    - hw:1,0 is available in capture mode and an active digital source must be 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)      connected to Di
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)    - hw:1,2 is not available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)  * ``device_setup=0x0D`` or ``0x10``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)    - 24bits 96kHz mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)    - Di is enabled by default for this mode but does not need to be connected 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)      to an active source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)    - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)    - hw:1,0 is available in captured mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)    - hw:1,2 is not available
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) In these modes the device is only Big-Endian compliant (see "Default Alsa driver 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) mode" above for an aplay command example)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) AC3 w/ DTS passthru mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) ~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) Thanks to Hakan Lennestal, I now have a report saying that this mode works.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)  * ``device_setup=0x03``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)    - 16bits 48kHz mode with only the Do port enabled 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)    - AC3 with DTS passthru
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)    - Caution with this setup the Do port is mapped to the pcm device hw:1,0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) The command line used to playback the AC3/DTS encoded .wav-files in this mode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)    % aplay -D hw:1,0 --channels=6 ac3_S16_LE_encoded_file.raw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) How to use the ``device_setup`` parameter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) The parameter can be given:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  * By manually probing the device (as root):::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)    # modprobe -r snd-usb-audio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)    # modprobe snd-usb-audio index=1 device_setup=0x09
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  * Or while configuring the modules options in your modules configuration file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)    (typically a .conf file in /etc/modprobe.d/ directory:::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)        alias snd-card-1 snd-usb-audio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)        options snd-usb-audio index=1 device_setup=0x09
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) CAUTION when initializing the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) -------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * Correct initialization on the device requires that device_setup is given to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)    the module BEFORE the device is turned on. So, if you use the "manual probing"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)    method described above, take care to power-on the device AFTER this initialization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  * Failing to respect this will lead to a misconfiguration of the device. In this case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)    turn off the device, unprobe the snd-usb-audio module, then probe it again with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)    correct device_setup parameter and then (and only then) turn on the device again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  * If you've correctly initialized the device in a valid mode and then want to switch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)    to  another mode (possibly with another sample-depth), please use also the following 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)    procedure:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)    - first turn off the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)    - de-register the snd-usb-audio module (modprobe -r)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)    - change the device_setup parameter by changing the device_setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)      option in ``/etc/modprobe.d/*.conf``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)    - turn on the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  * A workaround for this last issue has been applied to kernel 2.6.23, but it may not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)    be enough to ensure the 'stability' of the device initialization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) Technical details for hackers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) -----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) This section is for hackers, wanting to understand details about the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) internals and how Alsa supports it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) Audiophile USB's ``device_setup`` structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) If you want to understand the device_setup magic numbers for the Audiophile 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) USB, you need some very basic understanding of binary computation. However, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) this is not required to use the parameter and you may skip this section.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) The device_setup is one byte long and its structure is the following:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)        +---+---+---+---+---+---+---+---+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)        | b7| b6| b5| b4| b3| b2| b1| b0|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)        +---+---+---+---+---+---+---+---+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)        | 0 | 0 | 0 | Di|24B|96K|DTS|SET|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)        +---+---+---+---+---+---+---+---+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) Where:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)  * b0 is the ``SET`` bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)    - it MUST be set if device_setup is initialized 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)  * b1 is the ``DTS`` bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)    - it is set only for Digital output with DTS/AC3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)    - this setup is not tested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)  * b2 is the Rate selection flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)    - When set to ``1`` the rate range is 48.1-96kHz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)    - Otherwise the sample rate range is 8-48kHz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)  * b3 is the bit depth selection flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)    - When set to ``1`` samples are 24bits long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)    - Otherwise they are 16bits long
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)    - Note that b2 implies b3 as the 96kHz mode is only supported for 24 bits 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)      samples
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  * b4 is the Digital input flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)    - When set to ``1`` the device assumes that an active digital source is 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)      connected 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)    - You shouldn't enable Di if no source is seen on the port (this leads to 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)      synchronization issues)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)    - b4 is implied by b2 (since only one port is enabled at a time no synch 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)      error can occur) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)  * b5 to b7 are reserved for future uses, and must be set to ``0``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371)    - might become Ao, Do, Ai, for b7, b6, b4 respectively
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) Caution:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)  * there is no check on the value you will give to device_setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)    - for instance choosing 0x05 (16bits 96kHz) will fail back to 0x09 since 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)      b2 implies b3. But _there_will_be_no_warning_ in /var/log/messages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)  * Hardware constraints due to the USB bus limitation aren't checked
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)    - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)      only be able to use one at the same time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) USB implementation details for this device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) You may safely skip this section if you're not interested in driver 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) hacking.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) This section describes some internal aspects of the device and summarizes the 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) data I got by usb-snooping the windows and Linux drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) The M-Audio Audiophile USB has 7 USB Interfaces:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) a "USB interface":
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)  * USB Interface nb.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)  * USB Interface nb.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)    - Audio Control function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)  * USB Interface nb.2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)    - Analog Output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)  * USB Interface nb.3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)    - Digital Output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)  * USB Interface nb.4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)    - Analog Input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)  * USB Interface nb.5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)    - Digital Input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)  * USB Interface nb.6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)    - MIDI interface compliant with the MIDIMAN quirk 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) Each interface has 5 altsettings (AltSet 1,2,3,4,5) except:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)  * Interface 3 (Digital Out) has an extra Alset nb.6 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)  * Interface 5 (Digital In) does not have Alset nb.3 and 5 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) Here is a short description of the AltSettings capabilities:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * AltSettings 1 corresponds to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)   - 24-bit depth, 48.1-96kHz sample mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)   - Adaptive playback (Ao and Do), Synch capture (Ai), or Asynch capture (Di)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * AltSettings 2 corresponds to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)   - 24-bit depth, 8-48kHz sample mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)   - Asynch capture and playback  (Ao,Ai,Do,Di)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) * AltSettings 3 corresponds to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)   - 24-bit depth, 8-48kHz sample mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)   - Synch capture (Ai) and Adaptive playback (Ao,Do)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) * AltSettings 4 corresponds to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)   - 16-bit depth, 8-48kHz sample mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)   - Asynch capture and playback  (Ao,Ai,Do,Di)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) * AltSettings 5 corresponds to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)   - 16-bit depth, 8-48kHz sample mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)   - Synch capture (Ai) and Adaptive playback (Ao,Do)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) * AltSettings 6 corresponds to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)   - 16-bit depth, 8-48kHz sample mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)   - Synch playback (Do), audio format type III IEC1937_AC-3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) In order to ensure a correct initialization of the device, the driver 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) *must* *know* how the device will be used:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)  * if DTS is chosen, only Interface 2 with AltSet nb.6 must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)    registered
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)  * if 96KHz only AltSets nb.1 of each interface must be selected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)  * if samples are using 24bits/48KHz then AltSet 2 must me used if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)    Digital input is connected, and only AltSet nb.3 if Digital input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)    is not connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468)  * if samples are using 16bits/48KHz then AltSet 4 must me used if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)    Digital input is connected, and only AltSet nb.5 if Digital input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)    is not connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) When device_setup is given as a parameter to the snd-usb-audio module, the 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) parse_audio_endpoints function uses a quirk called 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) ``audiophile_skip_setting_quirk`` in order to prevent AltSettings not 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) corresponding to device_setup from being registered in the driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) Audiophile USB and Jack support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) ===============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) This section deals with support of the Audiophile USB device in Jack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) There are 2 main potential issues when using Jackd with the device:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) * support for Big-Endian devices in 24-bit modes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) * support for 4-in / 4-out channels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) Direct support in Jackd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) -----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) Jack supports big endian devices only in recent versions (thanks to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) Andreas Steinmetz for his first big-endian patch). I can't remember 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) exactly when this support was released into jackd, let's just say that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) with jackd version 0.103.0 it's almost ok (just a small bug is affecting 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) 16bits Big-Endian devices, but since you've read carefully the above
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) paragraphs, you're now using kernel >= 2.6.23 and your 16bits devices 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) are now Little Endians ;-) ).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) You can run jackd with the following command for playback with Ao and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) record with Ai:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502)   % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) Using Alsa plughw
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) If you don't have a recent Jackd installed, you can downgrade to using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) the Alsa ``plug`` converter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) For instance here is one way to run Jack with 2 playback channels on Ao and 2 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) capture channels from Ai:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)   % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) However you may see the following warning message:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)   You appear to be using the ALSA software "plug" layer, probably a result of 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518)   using the "default" ALSA device. This is less efficient than it could be. 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)   Consider using a hardware device instead rather than using the plug layer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) Getting 2 input and/or output interfaces in Jack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) ------------------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) As you can see, starting the Jack server this way will only enable 1 stereo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) input (Di or Ai) and 1 stereo output (Ao or Do).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) This is due to the following restrictions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) * Jack can only open one capture device and one playback device at a time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) * The Audiophile USB is seen as 2 (or three) Alsa devices: hw:1,0, hw:1,1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531)   (and optionally hw:1,2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) If you want to get Ai+Di and/or Ao+Do support with Jack, you would need to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) combine the Alsa devices into one logical "complex" device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) If you want to give it a try, I recommend reading the information from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) this page: http://www.sound-man.co.uk/linuxaudio/ice1712multi.html
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) It is related to another device (ice1712) but can be adapted to suit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) the Audiophile USB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) Enabling multiple Audiophile USB interfaces for Jackd will certainly require:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) * Making sure your Jackd version has the MMAP_COMPLEX patch (see the ice1712 page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) * (maybe) patching the alsa-lib/src/pcm/pcm_multi.c file (see the ice1712 page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) * define a multi device (combination of hw:1,0 and hw:1,1) in your .asoundrc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)   file 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) * start jackd with this device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) I had no success in testing this for now, if you have any success with this kind 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) of setup, please drop me an email.