You are not logged in.

#1 2018-02-12 18:03:58

fivre
Member
Registered: 2007-04-17
Posts: 97

PulseAudio sink number changes when plugging/unplugging HDMI

I have a monitor that provides an HDMI audio interface, which PA assigns a sink number, e.g.

09:47:42-0800 yagody $ pactl list sinks             
Sink #4                      
	State: RUNNING
	Name: alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra1
	Description: Built-in Audio Digital Stereo (HDMI 2)
	Driver: module-alsa-card.c
	Sample Specification: s16le 2ch 44100Hz
	Channel Map: front-left,front-right
	Owner Module: 6

However, if I unplug the monitor, wander around with my laptop a bit, and then come back, the sink number will change when I plug the monitor back in. Currently I have the sink number hard-coded into my i3 configuration:

bindsym XF86AudioRaiseVolume exec pactl set-sink-volume 4 +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume 4 -5%

While checking the sink number, editing my i3 config, and reloading every time I plug the laptop back into the monitor works, it's not the best setup. Is there any way that I can configure PA to always assign the same sink number for this particular device?

Offline

#2 2018-02-12 18:09:30

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,428

Re: PulseAudio sink number changes when plugging/unplugging HDMI

All of these commands take the fully qualified name as well and that is stable, use

pactl set-sink-volume alsa_output.pci-0000_00_1f.3.hdmi-stereo-extra1 +5%

If that sink happens to be your usual default sink and/or you switch default sinks often, you can also do cool stuff like

pactl set-sink-volume @DEFAULT_SINK@ +5%

Last edited by V1del (2018-02-12 18:10:10)

Offline

Board footer

Powered by FluxBB