我在无头系统上播放音频,然后通过 HDMI 连接了带扬声器的显示器。音频开始自动从显示器扬声器播放。
当我断开显示器的连接时,我无法再从原来的声音端口播放音频。
pacmd list-cards
现在显示有 9 张卡可用,在我添加显示器之前只有 1 张。
$ pacmd list-cards
Welcome to PulseAudio! Use "help" for usage information.
>>> 9 card(s) available.
index: 0
name: <alsa_card.pci-0000_06_00.1>
driver: <module-alsa-card.c>
owner module: 5
properties:
alsa.card = "1"
alsa.card_name = "HDA NVidia"
alsa.long_card_name = "HDA NVidia at 0xf9080000 irq 72"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:06:00.1"
sysfs.path = "/devices/pci0000:00/0000:00:03.0/0000:03:00.0/0000:04:08.0/0000:06:00.1/sound/card1"
列出的许多新卡pacmd list-cards
似乎都是网络摄像头,甚至不是音频设备:
index: 5
name: <alsa_card.usb-046d_Logitech_Webcam_C930e_4C329CAE-02-C930e_3>
我尝试pacmd set-default-sink 0
从 0 开始计数直到出现错误,看看是否可以以这种方式设置正确的音频设备。
我尝试过重新启动,但没有效果。
我已经设置了音量pactl -- set-sink-volume 0 90%
并验证扬声器可以正常工作。
$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
Home directory not accessible: Permission denied
card 0: PCH [HDA Intel PCH], device 0: ALC1150 Analog [ALC1150 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC1150 Digital [ALC1150 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: NVidia_1 [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 2: NVidia_1 [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: NVidia_1 [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: NVidia_1 [HDA NVidia], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
此外,有时我会陷入失败的状态pacmd
。
$ pacmd
No PulseAudio daemon running, or not running as session daemon.
我可以通过export $(dbus-launch)
运行 来修复这个pulseaudio &
问题。但我真的不明白为什么我这么做,我只是在一些相关问题上发现了一些建议。
验证默认音频设备是否正确:
$ pacmd list-sinks | grep -e 'name:' -e 'index'
index: 0
name: <alsa_output.pci-0000_06_00.1.hdmi-stereo>
index: 1
name: <alsa_output.pci-0000_05_00.1.hdmi-stereo>
* index: 2
name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
据我所知,我还没有触及系统范围的默认设置/etc/pulse/
。我尝试删除本地设置~/.config/pulse/