我安装了 7.1 环绕声卡,我想将输出拆分为 4 个立体声输出。这对 ALSA(甚至 PulseAudio)来说不是问题,但我无法让 Java 声音系统单独显示立体声输出。
这里有什么技巧?是否可以使用 ALSA 模拟硬件设备,以便 Java 能够看到它们?
Java 看到的是这样的:
Found Mixer: PulseAudio Mixer, version 0.02
Found source line: interface SourceDataLine supporting 42 audio formats, and buffers of 0 to 1000000 bytes
Line unavailable.
Found source line: interface Clip supporting 42 audio formats, and buffers of 0 to 1000000 bytes
Line unavailable.
Found target line: interface TargetDataLine supporting 42 audio formats, and buffers of 0 to 1000000 bytes
Line unavailable.
Found Mixer: DX [default], version 1.0.21
Found target line: interface TargetDataLine supporting 84 audio formats, and buffers of at least 32 bytes
Found Mixer: DX [plughw:0,0], version 1.0.21
Found source line: interface SourceDataLine supporting 96 audio formats, and buffers of at least 32 bytes
Found source line: interface Clip supporting 96 audio formats, and buffers of at least 32 bytes
Found target line: interface TargetDataLine supporting 24 audio formats, and buffers of at least 32 bytes
Found Mixer: DX [plughw:0,1], version 1.0.21
Found source line: interface SourceDataLine supporting 24 audio formats, and buffers of at least 32 bytes
Found source line: interface Clip supporting 24 audio formats, and buffers of at least 32 bytes
Found Mixer: Port DX [hw:0], version 1.0.21
Found source line: Mic source port
Found source line: Aux source port
Found source line: Analog Input Monitor source port
Found target line: Master target port
Found target line: Analog Input Monitor target port
这是我的.asoundrc:
pcm_slave.eightchannels {
pcm "surround71:DX,0"
channels 8
}
pcm.stereo1 {
type plughw
slave.pcm {
type dshare
ipc_key 87882222
slave eightchannels
bindings [ 2 3 ]
}
}
pcm.stereo2 {
type plughw
slave.pcm {
type dshare
ipc_key 87882222
slave eightchannels
bindings [ 4 5 ]
}
}
pcm.stereo3 {
type plughw
slave.pcm {
type dshare
ipc_key 87882222
slave eightchannels
bindings [ 6 7 ]
}
}
pcm.stereo4 {
type plughw
slave.pcm {
type dshare
ipc_key 87882222
slave eightchannels
bindings [ 0 1 ]
}
}
ALSA 配置工作正常,因为我可以使用扬声器测试 -D 立体声 1 在立体声 1...4 输出上播放声音。
谢谢你!
答案1
答案是:不可以。Java 无法列出用户定义的 ALSA pcms,因为它仅公开硬件设备和“默认”设备。
从 ALSA 开发人员处获得的信息:http://www.spinics.net/linux/fedora/alsa-user/msg10796.html