Re: [LAD] a little help with mutichannel alsa

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <grekimj@...>
Cc: <linux-audio-dev@...>
Date: Sunday, October 7, 2012 - 10:40 pm

--f46d0401f9330e22b304cb7fca0b
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Oct 7, 2012 at 4:03 PM, wrote:

> First, what I would like to do is pick which channel I send audio to on

with ALSA, devices named "hw:..." can only be configured in ways that match
the hardware capabilities of the device. no configuration that requires the
driver or libasound to resample, reformat etc. etc. are allowed. note that
this includes the number of channels, so if the h/w has N channels you
cannot configure it for anything other than N channels.

"plughw:..." devices are much more flexible and will use the full
capabilities (such as they are) of the driver and libasound to provide a
much broader configuration space.

> So, how do I access the subdevices/channels?

multichannel devices are multichannel devices. you don't open a different
device to get to different channels. you open it, and get a device with as
many channels as you specified. they will start at physical channel zero,
unless you use a psuedo-device (typically defined via an ~/.asoundrc file)
that maps physical channels to channels in the pseudo-device.

the way in which you access each channel depends on the configuration
parameters you use with the device. all the code i write uses
non-interleaved format, so that each channel's samples consist of a
contiguous block. some people prefer interleaved.

if you are just trying to write a functioning application rather than learn
to use ALSA, you will find it MUCH MUCH easier to just use JACK. if you
want to learn ALSA, be prepared to do a lot of reading of (a) the rather
non-explanatory reference documentation (b) finding examples of other
source code that uses ALSA in this way (e.g. JACK).

--p

--f46d0401f9330e22b304cb7fca0b
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Sun, Oct 7, 2012 at 4:03 PM, <grekimj@acousticrefuge.com> wrote:

First, what I would like to do is pick which channel I send audio to on the=
RME 9632 card.
My RME card is device 0.=A0
When I call this function:=A0 snd_pcm_open(&handle,device,SND_PCM_STREA=
M_PLAYBACK,0)

And set device =3D plughw:0,0=A0=A0 I get playback across all the RME outpu=
ts.
(Just using hw:0,0=A0 without the "plug" prefix does not work for=
some reason which may or may not matter.)with AL=
SA, devices named "hw:..." can only be configured in ways that ma=
tch the hardware capabilities of the device. no configuration that requires=
the driver or libasound to resample, reformat etc. etc. are allowed. note =
that this includes the number of channels, so if the h/w has N=20
channels you cannot configure it for anything other than N channels."plughw:..." devices are much more flexible and will use the ful=
l capabilities (such as they are) of the driver and libasound to provide a =
much broader configuration space.
=A0
So, how do I access the subdevices/channels?=A0
When I run aplay -l I only see 1/1 subdevices.
Shouldn't I be able to set my device to hw:0,0,1 or plughw:0,0,1 to acc=
ess channel 2, for example?multichannel devices a=
re multichannel devices. you don't open a different device to get to di=
fferent channels. you open it, and get a device with as many channels as yo=
u specified. they will start at physical channel zero, unless you use a psu=
edo-device (typically defined via an ~/.asoundrc file) that maps physical c=
hannels to channels in the pseudo-device.
the way in which you access each channel depends on the configuration p=
arameters you use with the device. all the code i write uses non-interleave=
d format, so that each channel's samples consist of a contiguous block.=
some people prefer interleaved.
if you are just trying to write a functioning application rather than l=
earn to use ALSA, you will find it MUCH MUCH easier to just use JACK. if yo=
u want to learn ALSA, be prepared to do a lot of reading of (a) the rather =
non-explanatory reference documentation (b) finding examples of other sourc=
e code that uses ALSA in this way (e.g. JACK).
--p

--f46d0401f9330e22b304cb7fca0b--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [LAD] a little help with mutichannel alsa, Paul Davis, (Sun Oct 7, 10:40 pm)
Re: [LAD] a little help with mutichannel alsa, Fons Adriaensen, (Mon Oct 8, 8:52 am)