All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Hills <mark@pogo.org.uk>
To: Daniel Mack <zonque@gmail.com>, alsa-devel@alsa-project.org
Subject: When to use sub-devices? (was Re: USB audio devices on Audio 4DJ and similar)
Date: Mon, 16 Apr 2012 21:55:54 +0100 (BST)	[thread overview]
Message-ID: <1204091942090.26902@vega> (raw)
In-Reply-To: <4F819CBD.2010809@gmail.com>

On Sun, 8 Apr 2012, Daniel Mack wrote:

> Hi Alan,
> 
> On 06.04.2012 23:09, Alan Horstmann wrote:
> > At present I am involved with resolving some issues that have arisen from 
> > people using the Audio 4DJ interface with Portaudio, and I hoped it would be 
> > OK to check a few Alsa details with you?  Unfortunately I have limited 
> > experience of USB audio.
> 
> What are those issues? Can you elaborate?
> 
> > Apparently the 4 audio inputs/outputs appear as 2 stereo sub-devices on the 
> > first device, rather than a single 4-channel device - is this correct?
> 
> Yes.
> 
> > Assuming that is correct, does that arise as a result of the intrinsic nature 
> > of the interface, or is it by developer choice in the driver (for example so 
> > that it can be opened as 2 stereo streams)?   Is there (or could there be) a 
> > way to change this, eg by module option or udev rule?  I notice in the source
> >     #define CHANNELS_PER_STREAM  2
> 
> The device itself implements 4 audio channels which are synced to each
> other. In other words: the hardware is not able to only enable one of
> them and leave the other ones paused or set sample rates individually.
> 
> When I implemented the driver, it seem most logical to follow the way
> the device denotes it channels though. The documentation and silk screen
> presents them as pairs of stereo, and so the driver does the same thing.
> 
> > Is there a way at present that the device can be accessed as a single 
> > 4-channel stream other than by creating a custom ~asoundrc with a pcm 
> > definition using 'multi' to join the 2 stereo streams?
> 
> No, you would need to join them in software. But as all inputs and
> outputs share a single clock domain, there won't be any drift between
> them that need special attention.

I am interested in this too; what is the 'official' or proper definition 
of a subdevice in ALSA and where should they be used?

It feels like there are many different interpretations.

The Audio4DJ and other snd-usb-caiaq devices are easier for general use 
because of the sub-devices -- multiple stereo ins/outs, each on a 
subdevice.

Whereas snd-usb-audio presents all channels on one, which then have to be 
split using asoundrc files [1].

Different software prefers separate devices (eg. xwax) or a single wide 
one (eg. Mixxx)

Is it possible (or sensible) to have both co-exist? Perhaps one covering 
the whole interface, the other covering the default 'logical' layout.

Yet another example is Echo Layla3G, which presents 8 inputs on 8 
subdevices which overlap:

               hardware channels
                0 1 2 3 4 5 6 7
             ,0 x x x x x x x x
             ,1   x x x x x x x
             ,2     x x x x x x
       sub-  ,3       x x x x x
      device ,4         x x x x
             ,5           x x x
             ,6             x x
             ,7               x

Opening .0 with 2 channels only disables .1. So you can open stereo pairs 
by opening 2 channels at each of:

  hw:Layla3G,0,0
  hw:Layla3G,0,2
  hw:Layla3G,0,4
  etc.

and mono channels by opening

  hw:Layla3G,0,0
  hw:Layla3G,0,1
  hw:Layla3G,0,2
  etc.

This is very useful, but feels more 'clever' rather than the use 
originally intended.

ALSA and asoundrc is flexible enough to deal with all these cases, but it 
can be rather confusing for users.

[1] http://www.pogo.org.uk/~mark/linuxdj/

-- 
Mark

      parent reply	other threads:[~2012-04-16 20:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06 21:09 USB audio devices on Audio 4DJ and similar Alan Horstmann
2012-04-08 14:12 ` Daniel Mack
2012-04-11 10:59   ` Alan Horstmann
2012-04-11 15:17     ` Daniel Mack
2012-04-11 15:20       ` Daniel Mack
2012-04-11 17:00       ` Alan Horstmann
2012-04-11 17:10         ` Daniel Mack
2012-04-12  7:34         ` Takashi Iwai
2012-04-16 20:55   ` Mark Hills [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1204091942090.26902@vega \
    --to=mark@pogo.org.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=zonque@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.