如何使用 dmix-slave 创建自定义 PCM 设备并在 audacious 中使用它而不触及全局 PCM?这可能吗?我尝试了各种配置,但没有成功。ALSA asound.conf 语法真的很奇怪。这是 aplay -L 输出:
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=SB
HDA ATI SB, ALC662 rev1 Analog
Default Audio Device
sysdefault:CARD=SB
HDA ATI SB, ALC662 rev1 Analog
Default Audio Device
front:CARD=SB,DEV=0
HDA ATI SB, ALC662 rev1 Analog
Front speakers
surround21:CARD=SB,DEV=0
HDA ATI SB, ALC662 rev1 Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=SB,DEV=0
HDA ATI SB, ALC662 rev1 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=SB,DEV=0
HDA ATI SB, ALC662 rev1 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=SB,DEV=0
HDA ATI SB, ALC662 rev1 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=SB,DEV=0
HDA ATI SB, ALC662 rev1 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=SB,DEV=0
HDA ATI SB, ALC662 rev1 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=SB,DEV=0
HDA ATI SB, ALC662 rev1 Digital
IEC958 (S/PDIF) Digital Audio Output
以及 aplay -l:
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC662 rev1 Digital [ALC662 rev1 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
问题的根源:由于 audacious/alsa 中的错误,在播放音乐时 audacious 消耗了太多的 CPU 时间。我在这里找到了一些解决方案https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613203。我创建了 ~/.asoundrc,其中包含以下几行:
pcm.!default {
type plug
slave.pcm {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
rate 44100
}
}
}
它确实有效,而且 audacious 只消耗少量的 CPU 时间。然而,这会导致 Firefox 中的声音播放出现问题。youtube 视频中的声音会卡顿。
答案1
关于主要问题:我已经像这样覆盖了 pcm.default:
pcm.dmixed {
type asym
playback.pcm {
# See plugin:dmix at http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html
type dmix
ipc_key 5678293
ipc_perm 0660
ipc_gid audio
slave {
channels 6
pcm {
format S16_LE
rate 44100
type hw
card 0
device 0
subdevice 0
}
# Play with this value, if you get errors "unable to set buffer size" or "underrun occured"
# 4320 is effective minimum with hda-intel, but flash in firefox needs at least 5000.
buffer_size 5000
period_time 0
#period_size 512
#periods 2
}
}
capture.pcm {
type null
}
}
pcm.!default {
type plug
slave.pcm "dmixed"
}
看一下这一行:
# 4320 is effective minimum with hda-intel, but flash in firefox needs at least 5000.
buffer_size 5000
这似乎奏效了。所以我最终解决了这个问题,而没有创建额外的 PCM 设备。