Looks like this topic is of very low interest only.
Perhaps I might rise some curiosity when I mention something very peculiar:
The IDs of the sound sources and sinks are not always the same after each reboot. From time to time, the IDs change:
├─ Sinks:
│ 34. Internes Audio Analog Stereo [vol: 0.74]
│ * 47. GM107 High Definition Audio Controller [GeForce 940MX] Digital Stereo (HDMI) [vol: 0.70]
├─ Sinks:
│ 31. Internes Audio Analog Stereo [vol: 0.74]
│ * 48. GM107 High Definition Audio Controller [GeForce 940MX] Digital Stereo (HDMI) [vol: 0.55]
Can anybody explain why this happens?
Anyway, as the sound IDs are apparently re-enumerated on each reboot, it does not seem to be enough to simply create an autostart entry with wpctl set-default {ID} but the correct ID has to be found out each time before attempting to set the default:
#!/bin/bash
# Sets the default sound device
# Set space as the delimiter
IFS=' '
# Read the split words into an array based on space delimiter
read -a strarr < <( wpctl status | grep HDMI )
# We will have to check whether our device is already the default;
# in that case, the ID entry starts with an asterisk.
# As it is complicated in bash to check if a string contains an asterisk (because it is a wildcard character),
# checking is only done if the first element of the array is alphanumeric or not
# Hopefully, wireplumber's IDs will always remain two-digit numbers :)
if [[ ${strarr[1]:0:2} = *[^[:alnum:]]* ]]; then
foundID="${strarr[2]:0:2}"
else
foundID="${strarr[1]:0:2}"
fi
wpctl set-default "${foundID}"
Not meant as a complaint - but I understand why Linux will never defeat Windows on the desktop
Not really as this guy is using pulseaudio instead of pipewire and wireplumber, just like in the question I linked to in my initial post: How to set default audio devices on XFCE?
For now, my script looks like a suitable workaround, although I must admit that I am still surprised by the fact that this topic seems to be of almost no interest. Perhaps the times of Linux / Kodi based HTPCs are gone for good, and these days, everybody uses Apple TV or something similar
But then, all those folks out there are connecting their Super-Duper 7.1 Dolby Surround Home Cinema Receivers using those wobbly 3.5" phone jacks to their Realtek Onboard sound? Looks like this is the case but it’s hard to believe
But you are using your Onboard sound, don’t you? In that case, there’s no problem because wireplumber seems to always default to an Onboard sound chip if it finds one.
Indeed. But as said, I had assumed that this would have been of interest to more than three people
In particular, with HTPCs where TV and audio devices are supposed to be connected via HDMI, and graphics cards being able to output audio via HDMI as well, I guess it will be extemely annoying if you would have to manually switch your audio output from Onboard to HDMI each time you start the HTPC.
The sink number can also be used in PulseAudio but the sink order and numbering is mutable
Internal devices do not change pci location code, but a USB device would change name if plugged in to a different USB socket
Just encountered another weirdness: As soon as the system switches off the monitors because of inactivity, to save power, the default sink is reset to be the onboard sound chip.
Unfortunately, xfce does not offer the possibility for programs to be started when the mouse is moved, and the system switches the monitors back on.
I don’t expect the Profile to change but it is a possibility. If the profile is unchanged after screen is blanked or after system reboot it should be persistent at all other times
That was the best advice for this problem. Thanks a lot once again. Looks like that configuration change now even survived hibernation mode.
I must admit that I wasn’t aware of the possibility to switch devices to input only.