我有一块 xmos-200 板,能够记录 8 个通道并通过 8 个通道推送输出。我将重点关注输出。
对于输出,有 4 个 3.5 毫米插孔,每个插孔有 2 个通道。该板被Linux识别,aplay -L显示
sysdefault:CARD=x20
xCORE USB Audio 2.0, USB Audio
Default Audio Device
front:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
Front speakers
surround40:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
Direct sample mixing device
dsnoop:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
Direct sample snooping device
hw:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
Direct hardware device without any conversions
plughw:CARD=x20,DEV=0
xCORE USB Audio 2.0, USB Audio
Hardware device with all software conversions
我可以使用所有输出端口和所有通道播放音频文件
aplay --device plughw:CARD=x20,DEV=0 camera.wav
我想选择使用 4 个立体声输出中的哪一个。对我如何做到这一点有任何帮助吗?
答案1
四个插孔在物理上是分开的,但软件只能看到一个八通道设备。
您可以使用 ALSA 插件拆分此设备:
pcm_slave.eightchannels {
pcm "hw:x20,0"
channels 8
rate 48000 # or whatever
}
pcm.stereo1 {
type plug
slave.pcm {
type dshare
ipc_key 20160316 # any random but unique number
slave eightchannels
bindings [ 0 1 ]
}
}
pcm.stereo2 {
type plug
slave.pcm {
type dshare
ipc_key 20160316
slave eightchannels
bindings [ 2 3 ]
}
}
pcm.stereo3 {
type plug
slave.pcm {
type dshare
ipc_key 20160316
slave eightchannels
bindings [ 4 5 ]
}
}
pcm.stereo4 {
type plug
slave.pcm {
type dshare
ipc_key 20160316
slave eightchannels
bindings [ 6 7 ]
}
}
要允许多个应用程序使用同一立体声设备,请替换dshare
为dmix
。