[pulseaudio-discuss] PulseAudio, switch audio output on device connection

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Wed Oct 8 04:06:54 PDT 2014


On Mon, 2014-10-06 at 19:47 +0200, Mark Gaiser wrote:
> Ok, i tried a bunch of different players. The results:
> - mplayer (smplayer as well) : sound doesn't switch when attaching a headphone
> - rhythmbox : refused to play any plain simple mp3 file
> - amarok : sound doesn't switch when attaching a headphone
> - dragon player : sound doesn't switch when attaching a headphone
> ...
> 
> I did get rhythmbox to beep once and that one came out of my headset.
> Based on that i'm beginning to think that there is some GTK vs Qt
> difference in play here.
> 
> One thing i did found (in the kde settings) was that i can prefer my
> headphone to be first in sound order. Funny thing is, this is actually
> working for an application like amarok which then behaves as i expect.
> However, other apps don't seem that happy to comply and just spew out
> audio to my jack port.

There shouldn't be that kind of differences between apps, unless you
have previously moved manually those applications around. What if you
clear the pulseaudio state by doing this:

- disable autospawning (so that you can be sure pulseaudio isn't running
during the next steps):
    cat "autospawn = no" >> ~/.config/pulse/client.conf

- killall pulseaudio

- remove all files under ~/.config/pulse except client.conf

- restart pulseaudio:
    pulseaudio -D

- load module-switch-on-connect:
    pactl load-module module-switch-on-connect

Is there still a difference in behaviour between amarok and other
applications?

Since you use kde, the routing may be a bit different than on my
machine, if you have module-device-manager loaded, and that might
explain the general problem of the automatic routing not working as
expected. When you start your kde session, module-device-manager gets
loaded. On gnome, for example, that module is not loaded by default.
Just restarting pulseaudio while the session is running should get rid
of module-device-manager, because it's only loaded when the session
starts, but you can of course always unload it with "pactl unload-module
module-device-manager". You can verify that the module is not loaded by
running "pactl list modules short". If module-device-manager isn't
listed, then it isn't loaded.

> Could you perhaps test if you can get the same thing working under mplayer?
> mplayer -ao pulse <some_mp3_file>
> 
> That is a quite simple test - easy to reproduce - and doesn't give me
> the expected result. I wonder how that works with you.

Works fine.

-- 
Tanu



More information about the pulseaudio-discuss mailing list