![在 pulseaudio 中禁用端口](https://linux22.com/image/1053830/%E5%9C%A8%20pulseaudio%20%E4%B8%AD%E7%A6%81%E7%94%A8%E7%AB%AF%E5%8F%A3.png)
当我运行 Steam 流媒体会话时,主声卡上选择的端口不断切换回扬声器。
我可以在哪里配置 pulseaudio 以完全禁用其中一个输出端口?
pacmd list-sinks 输出:
1 sink(s) available.
* index: 0
name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: RUNNING
suspend cause:
priority: 9959
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 17.29 ms
max request: 3 KiB
max rewind: 64 KiB
monitor source: 0
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 1
linked by: 1
configured latency: 21.33 ms; range is 0.50 .. 341.33 ms
card: 1 <alsa_card.pci-0000_00_1b.0>
module: 7
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALC3223 Analog"
alsa.id = "ALC3223 Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "1"
alsa.card_name = "HDA Intel PCH"
alsa.long_card_name = "HDA Intel PCH at 0xe3614000 irq 46"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:1b.0"
sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card1"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "9c20"
device.product.name = "8 Series HD Audio Controller"
device.form_factor = "internal"
device.string = "front:1"
device.buffering.buffer_size = "65536"
device.buffering.fragment_size = "32768"
device.access_mode = "mmap+timer"
device.profile.name = "analog-stereo"
device.profile.description = "Analogue Stereo"
device.description = "Built-in Audio Analogue Stereo"
alsa.mixer_name = "Realtek ALC3223"
alsa.components = "HDA:10ec0283,102805fb,00100003"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: unknown)
properties:
device.icon_name = "audio-speakers"
analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: yes)
properties:
device.icon_name = "audio-headphones"
active port: <analog-output-headphones>
答案1
笔记:如果您希望长期禁用某个端口,我建议您使用此方法。如果您想要修复不需要的自动端口切换,并且仍然能够使用所有端口,我建议您使用其他解决方案。
要完全禁用端口:
导航/usr/share/pulseaudio/alsa-mixer/paths
找到.conf
您想要禁用的端口的文件并添加.backup
其名称。
对于你的情况,你可能需要analog-output-speaker.conf
改为analog-output-speaker.conf.backup
这使得该文件对 pulseaudio 不可见,但将其保留为备份。
为了使更改生效,请注销并重新登录。
答案2
要长期禁用端口:
- 通过 识别要禁用的端口
pacmd list-cards
。 - 编辑
/usr/share/pulseaudio/alsa-mixer/profiles/defaultconf
。 - 注释掉每一个包含您的端口的块(例如
hdmi-output-2
)。 - 注销并登录。
在 Ubuntu 18.04 上,禁用 alsa-mixer 的解决方案paths
不起作用,您必须编辑profiles
。
答案3
记录一下:我遇到了插入耳机线的问题,导致顽固地切换到耳机的麦克风(虽然没有麦克风)。我是这样解决的:
sudo vim /usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf
;paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line
基本上我消除了*head{set,phone}-mic
周围的任何“
然后pulseaudio -k && pulseaudio --start
重新启动它,现在它总是强制使用内置麦克风,一切正常