[pulseaudio-discuss] hotplugging USB audio device

Colin Guthrie gmane at colin.guthr.ie
Thu Jul 10 03:21:41 PDT 2008


Werner LEMBERG wrote:
> I was told that PulseAudio might be a solution (I've never tried it
> yet).  How can I do this?

Just in case there is any doubt, pulse is *definitely* the right 
solution here.

While using pactl + hal would work I think it would be more sensible to 
do this via a module.

It would be fairly easy to write a "module-preferred-device" that would 
just sit in the background and wait for a preferred device to be plugged 
in... once it is plugged in, it would move all streams to it and set the 
default device to the one it found. Manually moved streams would still 
open on their own preferred device tho' (via module-volume-restore).

This should be fairly trivial to write..... You could have a list of 
preferred devices (stored in order of preference and a simple gui via 
paprefs could expose this.

I'd say this is probably the best solution. Doesn't exist yet but you're 
welcome to take a crack at it :D

You can probably use the code from module-always-sink and 
module-rescue-streams as a basis. Essentially what you are doing here is 
the opposite of rescue streams :) (or partially, in theory module-rescue 
streams could be made a bit brighter to rescue the streams to an ordered 
list of preferred sinks).


Col




More information about the pulseaudio-discuss mailing list