我已经从 Gnome 更改为 i3,并且希望能够使用终端切换音频输出(从耳机到 HDMI,反之亦然)。
$ pactl list cards | grep profile
Part of profile(s): output:hdmi-stereo, output:hdmi-surround, output:hdmi-surround71
Part of profile(s): output:hdmi-stereo-extra1, output:hdmi-surround-extra1
Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:iec958-stereo+input:analog-stereo
Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:iec958-stereo+input:analog-stereo
Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-40, output:analog-surround-40+input:analog-stereo
Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo
Part of profile(s): output:iec958-stereo, output:iec958-stereo+input:analog-stereo
我的耳机不应该在上面的输出中吗?
$ pactl list cards | grep headphones
analog-output-headphones: Headphones (priority: 9000, latency offset: 0 usec, available)
device.icon_name = "audio-headphones"
我尝试从耳机更改为 HDMI:
$ pactl set-card-profile 0 output:hdmi-stereo
$ pulseaudio -k # Should this be necessary?
没有什么变化。我还有什么事情要做吗?使用 Gnome 设置更改输出/接收器非常容易,因为只需选择我的耳机或 HDMI 输出即可。
更新一些更多信息:
$ pacmd list-sinks | grep -A 1 index
* index: 0
name: <alsa_output.pci-0000_01_00.1.hdmi-stereo>
--
index: 1
name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
$ pacmd set-default-sink 0 # Does nothing as far as I can tell
更新:
$ pacmd set-default-sink alsa_output.pci-0000_01_00.1.hdmi-stereo && pulseaudio -k && pulseaudio -D
以上关闭所有声音。这将再次打开它(通过耳机):
$ pacmd set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo && pulseaudio -k && pulseaudio -D