如何將獨特的音頻輸出到 PulseAudio 卡的多個埠/配置文件?
假設我有一張具有以下屬性的卡:
index: 1 name: <alsa_card.pci-0000_00_1f.3> driver: <module-alsa-card.c> owner module: 7 properties: alsa.card = "0" alsa.card_name = "HDA Intel PCH" alsa.long_card_name = "HDA Intel PCH at 0xf7240000 irq 129" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1f.3" sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.id = "a170" device.form_factor = "internal" device.string = "0" device.description = "Built-in Audio" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" profiles: input:analog-stereo: Analog Stereo Input (priority 60, available: unknown) output:analog-stereo: Analog Stereo Output (priority 6000, available: unknown) output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6060, available: unknown) output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5400, available: unknown) output:hdmi-stereo+input:analog-stereo: Digital Stereo (HDMI) Output + Analog Stereo Input (priority 5460, available: unknown) output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 300, available: unknown) output:hdmi-surround+input:analog-stereo: Digital Surround 5.1 (HDMI) Output + Analog Stereo Input (priority 360, available: unknown) output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 300, available: unknown) output:hdmi-surround71+input:analog-stereo: Digital Surround 7.1 (HDMI) Output + Analog Stereo Input (priority 360, available: unknown) output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 5200, available: unknown) output:hdmi-stereo-extra1+input:analog-stereo: Digital Stereo (HDMI 2) Output + Analog Stereo Input (priority 5260, available: unknown) output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 5200, available: unknown) output:hdmi-stereo-extra2+input:analog-stereo: Digital Stereo (HDMI 3) Output + Analog Stereo Input (priority 5260, available: unknown) output:hdmi-surround-extra2: Digital Surround 5.1 (HDMI 3) Output (priority 100, available: unknown) output:hdmi-surround-extra2+input:analog-stereo: Digital Surround 5.1 (HDMI 3) Output + Analog Stereo Input (priority 160, available: unknown) output:hdmi-surround71-extra2: Digital Surround 7.1 (HDMI 3) Output (priority 100, available: unknown) output:hdmi-surround71-extra2+input:analog-stereo: Digital Surround 7.1 (HDMI 3) Output + Analog Stereo Input (priority 160, available: unknown) off: Off (priority 0, available: unknown) active profile: <output:hdmi-stereo-extra1+input:analog-stereo> sinks: alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra1/#1: Built-in Audio Digital Stereo (HDMI 2) sources: alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra1.monitor/#1: Monitor of Built-in Audio Digital Stereo (HDMI 2) alsa_input.pci-0000_00_1f.3.analog-stereo/#2: Built-in Audio Analog Stereo ports: analog-input-headphone-mic: Microphone (priority 8700, latency offset 0 usec, available: unknown) properties: device.icon_name = "audio-input-microphone" analog-input-headset-mic: Headset Microphone (priority 8700, latency offset 0 usec, available: unknown) properties: device.icon_name = "audio-input-microphone" analog-output-lineout: Line Out (priority 9900, latency offset 0 usec, available: no) properties: 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" hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no) properties: device.icon_name = "video-display" hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: yes) properties: device.icon_name = "video-display" device.product.name = "Inspiron 7459" hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: no) properties: device.icon_name = "video-display"
我想將獨特的音頻流輸出到模擬輸出線路輸出,並可能輸出所有 (hdmi-output-0, hdmi-output-1, hdmi-output2): 埠。有沒有辦法在 PulseAudio 中同時做到這一點?我知道在 ALSA 我可以做類似的事情:
gst-launch-1.0 audiotestsrc ! alsasink device="hw:0,0" gst-launch-1.0 audiotestsrc ! alsasink device="hw:0,3"
但是我在 Pulse 中看到的表明我必須為“卡”設置一個“配置文件”,並且所有配置文件似乎都綁定到一個輸出埠。
有沒有辦法做到這一點,還是 Pulse 在這方面從根本上受到限制?
您必須編寫一個自定義配置文件,將您需要的所有 HDMI 輸出作為單獨的接收器公開。
查看Pulseaudio 文件中的配置
/usr/share/pulseaudio/alsa-mixer/paths/
文件,尤其是 中的文件。中的評論analog-output.conf.common
。所有這些都被嚴重低估了。
使其工作的嘗試:
修改
/usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf
並附加如下內容:[Profile output:analog-stereo+output:hdmi-stereo+output:hdmi-stereo+output:hdmi-stereo] description = Foobar output-mappings = analog-stereo hdmi-stereo hdmi-stereo-extra1 hdmi-stereo-extra2 input-mappings =
然後以普通桌面使用者身份重新啟動脈衝:
pulseaudio --kill; sleep 1; pulseaudio --start
將卡設置為使用新配置文件:
pacmd set-card-profile 0 output:analog-stereo+output:hdmi-stereo+output:hdmi-stereo+output:hdmi-stereo
現在
pacmd list-sinks
為新配置文件中標識的每個埠顯示一個不同的接收器。需要做的最後一件事是弄清楚如何不弄亂系統文件。如果可能的話,最好通過一個文件來做到這一點
~/.config/pulse
。編輯
這是如何為 M-Audio USB 設備設置新配置文件的描述。我也探勘了我所做的,這是一個輕微的變化(我不喜歡修改現有文件,它們往往會被包覆蓋升級):
我添加了一個
/etc/udev/rules.d/91-pulseaudio.rules
包含以下內容的新文件:# Custom Profile for onboard Intel 8086:12c0 SUBSYSTEM!="sound", GOTO="xpulseaudio_end" ACTION!="change", GOTO="xpulseaudio_end" KERNEL!="card*", GOTO="xpulseaudio_end" SUBSYSTEMS=="pci", ATTRS{vendor}=="0x8086", ATTRS{device}=="0x1c20", ENV{PULSE_PROFILE_SET}="my-personal.conf" LABEL="xpulseaudio_end"
這主要是從
/lib/udev/rules.d/90-pulseaudio.rules
.因為那是一個板載音效卡,這些規則必須在啟動時執行,所以它們應該在
initrd
你的核心使用的那個。我編譯自己的核心,並make-kpkg
複制這些規則,所以這對我來說不是問題。然後你添加一個新文件
/usr/share/pulseaudio/alsa-mixer/profile-sets/my-personal.conf
,你可以在其中列出你想要的配置(從其他配置文件複製和修改)。