alsa-project / alsa-lib

The Advanced Linux Sound Architecture (ALSA) - library
GNU Lesser General Public License v2.1
366 stars 177 forks source link

Incorrect device setting for M-Audio Audiophile USB sound card #166

Closed michele-perrone closed 2 years ago

michele-perrone commented 3 years ago

M-Audio Audiophile USB - fix needed

There is a problem with the ALSA configuration of the "M-Audio Audiophile USB" sound card. From the linux kernel documentation (https://www.kernel.org/doc/html/latest/sound/cards/audiophile-usb.html) you can see that this card has four audio interfaces:

These interfaces are distributed over three devices of the same card:

Now, this is where ALSA makes a bit of a mess.
If you look at the output of aplay - L (see attachment aplay_out.txt), you can see that the analog audio output is associated to CARD=USBtm,DEV=0 (which is correct), but you can also see that two digital outputs are assigned, one to CARD=USBtm,DEV=0 (wrong!) and another one to CARD=USBtm,DEV=1 (correct).
Speaking now of arecord - L (see attachment arecord_out.txt), there is only one input assigned to CARD=USBtm,DEV=0, and it is marked as "Front output / input" instead of SPDIF digital input. And most importantly, the analog input configuration, which should correspond to CARD=USBtm,DEV=1, is completely absent.
The result of this is that audio applications relying on ALSA don't know where to pick the correct inputs and outputs. If want both Ao and Ai to work in Jack, I have to select hw:USBtm,1 for the input and hw:USBtm,0 for the output. Alternatively, I have to create an .asoundrc file with the asym module (see attachment) and then run Jack with the name of my virtual device. However, this is just a workaround.
I'm not familiar with the alsa source but I know my way around C code. If you tell me where to look, I may be able to help fixing this.
Cheers!
Michele

Attachments: aplay_out.txt arecord_out.txt asoundrc.txt

perexg commented 2 years ago

I think that it may be worth to fix this in the kernel USB audio driver level using an quirk (make the analog/digital device numbers in sync). Please, create a bug at https://bugzilla.kernel.org - audio component.

@tiwai : FYI.