public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
* USB-Audio.conf routing and dmix
@ 2015-05-09  0:20 sylvain.bertrand
  2015-05-11 19:57 ` sylvain.bertrand
  2015-05-15  8:13 ` Raymond Yau
  0 siblings, 2 replies; 9+ messages in thread
From: sylvain.bertrand @ 2015-05-09  0:20 UTC (permalink / raw)
  To: alsa-devel

Hi,

I have a bose USB audio 5.1 device, a generic USB audio device.

I noticed that the proper channels routing was missing from the default generic
USB pcm, but dmix was used. And for the surround pcms I noticed it was the
other way around!

I did modify the default pcm to include a routing plugin. I put 8 channels in
the routing plugin. I guess the proper way would be to detect the hw card
number of channels and select a route plugin configuration with the correct
count of channels (maybe their is a function to get that info?).

I linked the surround51 and surround71 pcms with the 'disable-able' dmix
section from the default pcm.

I did not touch the surround40* pcms, surround pcms which are specific to some
cards and the iec958 ones.

http://filebin.ca/214UTT8fBnUm/USB-Audio.conf


regards,

-- 
Sylvain BERTRAND

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: USB-Audio.conf routing and dmix
  2015-05-09  0:20 USB-Audio.conf routing and dmix sylvain.bertrand
@ 2015-05-11 19:57 ` sylvain.bertrand
  2015-05-13  9:24   ` Clemens Ladisch
  2015-05-15  8:13 ` Raymond Yau
  1 sibling, 1 reply; 9+ messages in thread
From: sylvain.bertrand @ 2015-05-11 19:57 UTC (permalink / raw)
  To: alsa-devel

On Sat, May 09, 2015 at 12:20:17AM +0000, sylvain.bertrand@gmail.com wrote:
> Hi,
> 
> I have a bose USB audio 5.1 device, a generic USB audio device.
> 
> I noticed that the proper channels routing was missing from the default generic
> USB pcm, but dmix was used. And for the surround pcms I noticed it was the
> other way around!
> 
> I did modify the default pcm to include a routing plugin. I put 8 channels in
> the routing plugin. I guess the proper way would be to detect the hw card
> number of channels and select a route plugin configuration with the correct
> count of channels (maybe their is a function to get that info?).
> 
> I linked the surround51 and surround71 pcms with the 'disable-able' dmix
> section from the default pcm.
> 
> I did not touch the surround40* pcms, surround pcms which are specific to some
> cards and the iec958 ones.
> 
> http://filebin.ca/214UTT8fBnUm/USB-Audio.conf

did I post on the right mailing list for alsa-lib default configuration improvment?

-- 
Sylvain

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: USB-Audio.conf routing and dmix
  2015-05-11 19:57 ` sylvain.bertrand
@ 2015-05-13  9:24   ` Clemens Ladisch
  2015-05-13 11:32     ` sylvain.bertrand
  0 siblings, 1 reply; 9+ messages in thread
From: Clemens Ladisch @ 2015-05-13  9:24 UTC (permalink / raw)
  To: sylvain.bertrand, alsa-devel

sylvain.bertrand@gmail.com wrote:
> did I post on the right mailing list for alsa-lib default configuration improvment?

Yes.

>> I noticed that the proper channels routing was missing from the default generic
>> USB pcm

The "default" device is supposed to have two channels.

>> I guess the proper way would be to detect the hw card number of
>> channels and select a route plugin configuration with the correct
>> count of channels (maybe their is a function to get that info?).

The number of channels can depend on other factors.

>> I linked the surround51 and surround71 pcms with the 'disable-able' dmix
>> section from the default pcm.

These devices are not supposed to use plug or dmix.


Regards,
Clemens

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: USB-Audio.conf routing and dmix
  2015-05-13  9:24   ` Clemens Ladisch
@ 2015-05-13 11:32     ` sylvain.bertrand
  2015-05-15  2:07       ` sylvain.bertrand
  0 siblings, 1 reply; 9+ messages in thread
From: sylvain.bertrand @ 2015-05-13 11:32 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Wed, May 13, 2015 at 11:24:32AM +0200, Clemens Ladisch wrote:
>>> I linked the surround51 and surround71 pcms with the 'disable-able' dmix
>>> section from the default pcm.
> 
> These devices are not supposed to use plug or dmix.

Ok. Then, there is no pcm to output 5.1 sound with dmix.

Does it mean that the application is in charge to build a alsa-lib pipeline
with dmix pcm and surround51 pcm, in order to let other applications output 5.1
sound at the same time?

regards,

-- 
Sylvain

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: USB-Audio.conf routing and dmix
  2015-05-13 11:32     ` sylvain.bertrand
@ 2015-05-15  2:07       ` sylvain.bertrand
  2015-05-15  5:53         ` Alexander E. Patrakov
  0 siblings, 1 reply; 9+ messages in thread
From: sylvain.bertrand @ 2015-05-15  2:07 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: alsa-devel

On Wed, May 13, 2015 at 11:32:15AM +0000, sylvain.bertrand@gmail.com wrote:
> On Wed, May 13, 2015 at 11:24:32AM +0200, Clemens Ladisch wrote:
> >>> I linked the surround51 and surround71 pcms with the 'disable-able' dmix
> >>> section from the default pcm.
> > 
> > These devices are not supposed to use plug or dmix.
> 
> Ok. Then, there is no pcm to output 5.1 sound with dmix.
> 
> Does it mean that the application is in charge to build a alsa-lib pipeline
> with dmix pcm and surround51 pcm, in order to let other applications output 5.1
> sound at the same time?

Then what is the "Right"(tm) way to do that?

-- 
Sylvain

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: USB-Audio.conf routing and dmix
  2015-05-15  2:07       ` sylvain.bertrand
@ 2015-05-15  5:53         ` Alexander E. Patrakov
  2015-05-15  5:58           ` Alexander E. Patrakov
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander E. Patrakov @ 2015-05-15  5:53 UTC (permalink / raw)
  To: sylvain.bertrand, Clemens Ladisch; +Cc: alsa-devel

15.05.2015 07:07, sylvain.bertrand@gmail.com wrote:
> On Wed, May 13, 2015 at 11:32:15AM +0000, sylvain.bertrand@gmail.com wrote:
>> On Wed, May 13, 2015 at 11:24:32AM +0200, Clemens Ladisch wrote:
>>>>> I linked the surround51 and surround71 pcms with the 'disable-able' dmix
>>>>> section from the default pcm.
>>>
>>> These devices are not supposed to use plug or dmix.
>>
>> Ok. Then, there is no pcm to output 5.1 sound with dmix.
>>
>> Does it mean that the application is in charge to build a alsa-lib pipeline
>> with dmix pcm and surround51 pcm, in order to let other applications output 5.1
>> sound at the same time?
>
> Then what is the "Right"(tm) way to do that?
>

[this is my personal opinion, in no way official]

The right way seems to be to use PulseAudio. Pure ALSA, in its default 
configuration, just does not support mixing 5.1 audio, on any card. This 
default cannot really be changed, because there are many people who use 
5.1 cards for output to stereo headphones only, i.e. who need automatic 
downmixing if an app (such as VLC) starts a 5.1 stream. The default 
plug/dmix setup provides such downmixing.

Those who actually have a 5.1 system and need to opt out of this 
downmixing must actively do it (both with ALSA and with PulseAudio). For 
PulseAudio, it is as simple as starting pavucontrol and selecting a 5.1 
output profile for the relevant card. For ALSA, a config has to be 
created from scratch. On some cards, the config suggested by mpv 
developers works:

https://github.com/mpv-player/mpv/wiki/ALSA:-Surround-Sound-and-Upmixing

As an application developer, just tell your users "your default device 
needs to support 5.1, see you there", as mpv developers did. This will 
be the case either with PulseAudio or with a hacked .asoundrc.

OTOH, I will be happy to review a patch that makes the dmix channel 
count configurable on a per-card basis in .asoundrs in a way similar to 
the rate. But that's hard - you will have to change all card configs, 
and implement some conditional blocks because some cards expose 
themselves as several stereo devices, so you want a multi plugin on 
several instances of dmix then.

-- 
Alexander E. Patrakov

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: USB-Audio.conf routing and dmix
  2015-05-15  5:53         ` Alexander E. Patrakov
@ 2015-05-15  5:58           ` Alexander E. Patrakov
  0 siblings, 0 replies; 9+ messages in thread
From: Alexander E. Patrakov @ 2015-05-15  5:58 UTC (permalink / raw)
  To: sylvain.bertrand, Clemens Ladisch; +Cc: alsa-devel

15.05.2015 10:53, Alexander E. Patrakov wrote:
> 15.05.2015 07:07, sylvain.bertrand@gmail.com wrote:
>> On Wed, May 13, 2015 at 11:32:15AM +0000, sylvain.bertrand@gmail.com
>> wrote:
>>> On Wed, May 13, 2015 at 11:24:32AM +0200, Clemens Ladisch wrote:
>>>>>> I linked the surround51 and surround71 pcms with the
>>>>>> 'disable-able' dmix
>>>>>> section from the default pcm.
>>>>
>>>> These devices are not supposed to use plug or dmix.
>>>
>>> Ok. Then, there is no pcm to output 5.1 sound with dmix.
>>>
>>> Does it mean that the application is in charge to build a alsa-lib
>>> pipeline
>>> with dmix pcm and surround51 pcm, in order to let other applications
>>> output 5.1
>>> sound at the same time?
>>
>> Then what is the "Right"(tm) way to do that?
>>
>
> [this is my personal opinion, in no way official]
>
> The right way seems to be to use PulseAudio. Pure ALSA, in its default
> configuration, just does not support mixing 5.1 audio, on any card. This
> default cannot really be changed, because there are many people who use
> 5.1 cards for output to stereo headphones only, i.e. who need automatic
> downmixing if an app (such as VLC) starts a 5.1 stream. The default
> plug/dmix setup provides such downmixing.

I need to test things before posting. This is wrong, plug/dmix does not 
include the extra channels in the stereo mix.

> As an application developer, just tell your users "your default device
> needs to support 5.1, see you there", as mpv developers did. This will
> be the case either with PulseAudio or with a hacked .asoundrc.

This is still my position.

-- 
Alexander E. Patrakov

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: USB-Audio.conf routing and dmix
  2015-05-09  0:20 USB-Audio.conf routing and dmix sylvain.bertrand
  2015-05-11 19:57 ` sylvain.bertrand
@ 2015-05-15  8:13 ` Raymond Yau
  2015-05-15 13:16   ` sylvain.bertrand
  1 sibling, 1 reply; 9+ messages in thread
From: Raymond Yau @ 2015-05-15  8:13 UTC (permalink / raw)
  To: sylvain.bertrand; +Cc: ALSA Development Mailing List

>
> I have a bose USB audio 5.1 device, a generic USB audio device.
>
> I noticed that the proper channels routing was missing from the default
generic
> USB pcm, but dmix was used. And for the surround pcms I noticed it was the
> other way around!
>
> I did modify the default pcm to include a routing plugin. I put 8
channels in
> the routing plugin. I guess the proper way would be to detect the hw card
> number of channels and select a route plugin configuration with the
correct
> count of channels (maybe their is a function to get that info?).
>
> I linked the surround51 and surround71 pcms with the 'disable-able' dmix
> section from the default pcm.
>
> I did not touch the surround40* pcms, surround pcms which are specific to
some
> cards and the iec958 ones.
>
> http://filebin.ca/214UTT8fBnUm/USB-Audio.conf
>
>

Post the output of your usb audio

lsusb -vvvv

Most likely your usb audio device does not support stereo

Post output of alsa-info.sh

Pulseaudio don't support if your volume control have more than two channels

http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa?id=527078523815587bfd021bc1d10782403e9b3e84

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: USB-Audio.conf routing and dmix
  2015-05-15  8:13 ` Raymond Yau
@ 2015-05-15 13:16   ` sylvain.bertrand
  0 siblings, 0 replies; 9+ messages in thread
From: sylvain.bertrand @ 2015-05-15 13:16 UTC (permalink / raw)
  To: Raymond Yau; +Cc: ALSA Development Mailing List

My USB audio does work fine. The only thing: apps cannot output at the same
time 5.1 on that device.  (stereo goes through dmix by default so it's fine). 

Why does alsa-lib limit dmix/plug usage to stereo only? Is there a good reason?

-- 
Sylvain

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-05-15 13:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-09  0:20 USB-Audio.conf routing and dmix sylvain.bertrand
2015-05-11 19:57 ` sylvain.bertrand
2015-05-13  9:24   ` Clemens Ladisch
2015-05-13 11:32     ` sylvain.bertrand
2015-05-15  2:07       ` sylvain.bertrand
2015-05-15  5:53         ` Alexander E. Patrakov
2015-05-15  5:58           ` Alexander E. Patrakov
2015-05-15  8:13 ` Raymond Yau
2015-05-15 13:16   ` sylvain.bertrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox