How to switch 'default' sound device controlled by hardware keys in Xubuntu?

I got a clue somewhere to look in Settings / Settings Editor (not the normal Settings Manager)

Then, under xfce4-mixer, there was the setting /active-card which had the value:

PlaybackHighDefinitionAudioControllerDigitalStereoHDMIPulseAudioMixer

I selected 'active-card', and hit the 'Reset Property' button. That turned the setting into:

PlaybackBuiltinAudioAnalogStereoPulseAudioMixer

( These names closely follow the names of the Output Devices in pavucontrol see screenshot )

After a reboot, it worked. My volume buttons now affect the volume in the speakers.

(Scrub my earlier, now deleted, hint/comment about Play/Pause not working. They (still) work fine in Rhythmbox - that was/is an unrelated problem with gmusicbrowser)

This may or may not work for you! :-)

EDIT: For some reason, my xfce profile got corrupted and I've restarted from scratch by rm -rf ~/.config. Now, only a few days later, resetting it didn't work for me either, but setting /active-card to PlaybackBuiltinAudioAnalogStereoPulseAudioMixer did.

EDIT: If the above did not work try setting this via terminal and xfconf, e.g.

    xfconf-query -c xfce4-mixer -p /active-card -s 'PlaybackBuiltinAudioAnalogStereoPulseAudioMixer'

For those who do not have /active-card, it is not needed anyway, nor is the xfce4-mixer. The sound is going through PulseAudio and therefore the "default" device is selected by the configuration of PulseAudio, and xfce4-volumed will only change the "default" outputs volume.

However you can use PulseAudios configuration tool for this, pacmd.

$ pacmd
Welcome to PulseAudio! Use "help" for usage information.
>>>
  1. First list the devices on your machine

    >>> list-sinks
    

    It will print a lot of information about your devices, and as visible they all have an index

    2 sink(s) available.
      * index: 0
        name: <alsa_output.pci-0000_00_03.0.hdmi-stereo>
            ...
        index: 1
        name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
            ...
    
  2. You need to set your preferred device as default. As you can see (the little star, i.e. *, before index:0) my HDMI was the default and I wanted the Analog output.

    >>> set-default-sink 1
    

You may need to kill xfce4-volumed and restart it, to have the desired effect without full system restart:

    $pkill volumed
    $xfce4-volumed

But basically, that is it.