My speakers are plugged via optical output. Each time my screen wake up from sleep, pusleaudio automatically switch to HDMI audio where nothing is plugged.
How can I prevent that ?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityMy speakers are plugged via optical output. Each time my screen wake up from sleep, pusleaudio automatically switch to HDMI audio where nothing is plugged.
How can I prevent that ?
Let me know if this doesn't work for you and I'll delete my answer. I don't have your speaker system but this should work.
When signal is lost to during sleep, Pulse Audio is automatically configured to activate the default source (your HDMI). Upon resume the sound device is still on HDMI. To override this setting, tell Pulse Audio to never switch sound devices automatically:
/etc/pulse/default.pa
load-module module-switch-on-port-available
#
at the beginning of the line to disable automatic port switchingpulseaudio -k
to reload configurationWinEunuuchs2Unix's post is correct, but I had to adjust module-switch-on-connect
instead of module-switch-on-port-available
. Here's an easy one-liner:
sudo sed -i 's/^load-module module-switch-on-connect$/# load-module module-switch-on-connect/g' /etc/pulse/default.pa && pulseaudio -k
switch-on-port-available
and disabling swith-on-connect
I finally managed what I want: automatic switching between speakers/headphones, but ignoring my docking station. Thank you! This has been bugging me for about a year now.
Feb 23, 2021 at 9:31
on-port-available
and on-connect
?
Feb 26, 2021 at 18:45
on-connect
is the event that a new device is connected which has an audio port, such as a usb dock. on-port-available
is the event that a port becomes usable, for example when you insert a mini jack.
Feb 26, 2021 at 20:59
By the way just related I had the same problem. There seem to be a bug report up on Launchpad https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1847570