[pulseaudio-discuss] Way to treat (almost) equal sound-devices different?

Tanu Kaskinen tanuk at iki.fi
Wed Feb 3 04:23:30 PST 2016


On Wed, 2016-02-03 at 12:42 +0100, Stefan Neufeind wrote:
> Hi,
> 
> I'm using an external dock which contains sound-output. One such
> dock-box at work, one in the home-office. Basically it's usb-connected
> with an additional external sound-device in the dock.
> 
> Pulseaudio knows when the dock is not connected and falls back to
> internal sound-output.
> 
> But is there a way to differentiate which of the two docks is connected,
> maybe by taking the serial-number of the dock into account?
> 
> I didn't find any status of "speakers (not) connected" in pulseaudio for
> that device unfortunately. Of course that would work for me as well.
> 
> My current idea was that at work where there are no external speakers
> connected currently it might want to use the internal sound while at
> home it should use the additional output from the dock.

Compare the output from "pactl list sinks" between the two docks. Are
there any differences? If not, then I don't think it's possible to
distinguish the docks from each other.

If the names of the sinks are different, then it might be possible to
achieve what you want with just some configuration: put "load-module
module-device-manager do_routing=true" to /etc/pulse/default.pa and
then configure the device priorities as appropriate. Unfortunately, the
only way to configure the priorities is KDE's KMix, as far as I know,
so if you're not using KDE and using KMix isn't practical, then this
approach won't work.

If the names of the sinks are same, but there are some differences in
the sink properties, then you could write a script that monitors what
sound cards are present and changes the default sink based on that.
This alternative works also if the lack of KMix prevents you from using
the previous approach.

I hope we'll improve in this area in the future.

-- 
Tanu


More information about the pulseaudio-discuss mailing list