[LAD] Merging alsa subdevices into multichannel
Eliot Blennerhassett
linux at audioscience.com
Tue Nov 18 20:54:38 UTC 2008
On Tuesday 18 November 2008 11:45:51 Jens M Andreasen wrote:
> When I connect to hw:0,0 the first application will grab hw:0,0,0 the
> next application will grab hw:0,0,1 and the third application will grab
> hw:0,0,2 ("mic", "front mic" and "line in" assuming this is the order
> they are selected in the mixer app)
My mental model of this is that each subdevice represents a separate (stereo)
ADC. (BTW The ordering of hw0,0,[0,1,2] may be independent of the order of
those controls in the mixer app)
> How do I do to make jackd understand that it should open all three of
> them instead of only one?
As long as they all run from the same clock, you can create a 6
channel 'device' in your .asoundrc
Two examples follow.
The first is parameterised on card/dev/subdev
Eg ttable4:1,2,3 will use card1, device2, link subdevices 3 and 4 into a 4
channel stream.
The second is 16 channel with only card as a parameter. Always uses device0,
subdevices 0..7 (You can cut this one down to make your 6 channel device)
use it like: jackd -d alsa -C ttable16
Sorry I don't know how to make it less verbose, or how to make the number of
channels parameterisable.
regards
--
Eliot Blennerhassett
http://www.audioscience.com
# This creates a 4 channel interleaved pcm stream based on
# the multi device. JACK will work with this one.
pcm.ttable4 {
@args [ CARD DEV SUBDEV ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_PCM_CARD
ALSA_CARD
]
default {
@func refer
name defaults.pcm.card
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars [
ALSA_PCM_DEVICE
]
default {
@func refer
name defaults.pcm.device
}
}
}
@args.SUBDEV {
type integer
default 0
}
type route;
hint {
show {
@func refer
name defaults.namehint.basic
}
description "4 channel multi route"
}
slave.pcm {
type multi;
slaves.a.pcm {
type hw
card $CARD
device $DEV
subdevice $SUBDEV
#mmap_emulation true
}
slaves.a.channels 2;
slaves.b.pcm {
type hw
card $CARD
device $DEV
subdevice { @func iadd integers [ $SUBDEV 1 ] }
#mmap_emulation true
}
slaves.b.channels 2;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave b;
bindings.2.channel 0;
bindings.3.slave b;
bindings.3.channel 1;
}
ttable.0.0 1;
ttable.1.1 1;
ttable.2.2 1;
ttable.3.3 1;
}
# see above.
ctl.ttable4 {
@args [ CARD DEV SUBDEV ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_PCM_CARD
ALSA_CARD
]
default {
@func refer
name defaults.pcm.card
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars [
ALSA_PCM_DEVICE
]
default {
@func refer
name defaults.pcm.device
}
}
}
@args.SUBDEV {
type integer
default 0
}
type hw;
card $CARD;
}
# This creates a 16 channel interleaved pcm stream based on
# the multi device. JACK will work with this one.
pcm.ttable16 {
@args [ CARD ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_PCM_CARD
ALSA_CARD
]
default {
@func refer
name defaults.pcm.card
}
}
}
hint {
show {
@func refer
name defaults.namehint.basic
}
description "16 channel multi route"
}
type route;
slave.pcm {
type multi;
slaves.a.pcm {
type hw
card $CARD
device 0
subdevice 0
}
slaves.a.channels 2;
slaves.b.pcm {
type hw
card $CARD
device 0
subdevice 1
}
slaves.b.channels 2;
slaves.c.pcm {
type hw
card $CARD
device 0
subdevice 2
}
slaves.c.channels 2;
slaves.d.pcm {
type hw
card $CARD
device 0
subdevice 3
}
slaves.d.channels 2;
slaves.e.pcm {
type hw
card $CARD
device 0
subdevice 4
}
slaves.e.channels 2;
slaves.f.pcm {
type hw
card $CARD
device 0
subdevice 5
}
slaves.f.channels 2;
slaves.g.pcm {
type hw
card $CARD
device 0
subdevice 6
}
slaves.g.channels 2;
slaves.h.pcm {
type hw
card $CARD
device 0
subdevice 7
}
slaves.h.channels 2;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave b;
bindings.2.channel 0;
bindings.3.slave b;
bindings.3.channel 1;
bindings.4.slave c;
bindings.4.channel 0;
bindings.5.slave c;
bindings.5.channel 1;
bindings.6.slave d;
bindings.6.channel 0;
bindings.7.slave d;
bindings.7.channel 1;
bindings.8.slave e;
bindings.8.channel 0;
bindings.9.slave e;
bindings.9.channel 1;
bindings.10.slave f;
bindings.10.channel 0;
bindings.11.slave f;
bindings.11.channel 1;
bindings.12.slave g;
bindings.12.channel 0;
bindings.13.slave g;
bindings.13.channel 1;
bindings.14.slave h;
bindings.14.channel 0;
bindings.15.slave h;
bindings.15.channel 1;
}
ttable.0.0 1;
ttable.1.1 1;
ttable.2.2 1;
ttable.3.3 1;
ttable.4.4 1;
ttable.5.5 1;
ttable.6.6 1;
ttable.7.7 1;
ttable.8.8 1;
ttable.9.9 1;
ttable.10.10 1;
ttable.11.11 1;
ttable.12.12 1;
ttable.13.13 1;
ttable.14.14 1;
ttable.15.15 1;
}
# see above.
ctl.ttable16 {
@args [ CARD ]
@args.CARD {
type string
default {
@func getenv
vars [
ALSA_PCM_CARD
ALSA_CARD
]
default {
@func refer
name defaults.pcm.card
}
}
}
type hw;
card $CARD;
}
More information about the Linux-audio-dev
mailing list