[pulseaudio-discuss] Changing default soundcard on attach/detach of soundcards

Colin Guthrie gmane at colin.guthr.ie
Wed Jun 16 00:59:49 PDT 2010

'Twas brillig, and Jason Taylor at 16/06/10 00:58 did gyre and gimble:
>> Why does the music move to the bluetooth headset in the final example?
>> You seem to suggest that if the priority lists for music is as follows
>> immediately before the BT headset is attached:
>> 1. USB Speakers
>> 2. USB Headset
>> 3. Internal Audio
>> But afterwards plugging in the BT Headset, it's not clear as to whether
>> the list is:
>> 1. USB Speakers
>> 2. BT Headset
>> 3. USB Headset
>> 4. Internal Audio
>> or
>> 1. USB Speakers
>> 2. USB Headset
>> 3. BT Headset
>> 4. Internal Audio
>> Both lists would achieve the result you describe as the USB Headset is
>> not currently plugged in. I presume you mean the first example, in which
>> case I'd infer your logic for picking the insertion point of the new
>> device as being "immediately after the highest priority available
>> device". This would thus cause no immediate change, but certainly
>> ensures that it messes up any careful configuration the user does.
> What I would like
> Music Streams have a  user set rule of always go to USB Speakers, if
> the USB speakers not pugged in then follow the priority list.
> Priority list is the order in which I plugged devices in.. (this is
> local machine devices only)
>  - Bluetooth headset
>  - USB headset
>  - USB speakers
>  - Internal
> If a device is removed it should be removed from the priority list, so
> unplugging the USB headset gives
>  - Bluetooth headset
>  - USB speakers
>  - Internal
> Plugging USB headset back in gives
>  - USB headset
>  - Bluetooth
>  - USB speakers
>  - Internal
> Devices which have a preferred device set should always use that
> device if available, else fall back to following the priority list
> I don't consider this magic from the point of view of the user.. its
> fairly simple sound moves to the device I just plugged in unless I've
> set up configuration to tell it not to
> I don't know if we are going to agree here :)

I think we can agree on that last statement :p

> You want the user to manually select devices, I want the user to be
> able to override a sane (IMHO) default device selection behavior

I'm not against supporting this in some capacity, but I would not want
it to be the default behaviour.

To summarise my original plan, what I want to see is as follows:
 * A core system to handle priority lists
 * Internal API to allow modules to manipulate where new devices enter a
given priority list.

(Lennart doesn't fully agree here FWIW, but that's another story).

With the above approach I intended to make module-intended-roles a
"passive" module in the sense that it will not directly manipulate the
device a given stream uses, but actually dictate where in the priority
list a new device is injected.

e.g. when a new BT Headset is discovered, module-intended-roles would
basically check to see whether the device is already in the "voip"
priority list and if not, it would inject it at the top, rather than the
bottom of the list (there could be various caveats included in this logic).

Otherwise it would do nothing and the default behaviour would ultimately
be triggered and put new devices at the end of any priority lists.

Now, incorporating what you suggest, I guess I have nothing against a
specific module that actually manipulates a given priority list for you.
e.g. you could have a module-prefer-usb-for-music module that actually
implements your desired behaviour in a purely modular fashion by
automatically rearranging your music priority list for you. Personally I
think most users would not want it, but for those who do they can load it.

That way we're both happy and the decision as to whether the module is
on by default can be a distro one and/or generally decided.

> I want to be able to tell my sister that all she has to do to use her
> headset is "plug it in".
> At the moment I have to tell her to plug the headset in.. left click
> on the speaker icon, click settings, goto output tab, click the
> "correct" output, now restart what ever app your using....

You don't need to restart. Just move the stream in Playback tab and
it'll work fine *and* remember it for next time.

But I agree that the current way of working sucks anyway, which is why I
wrote my initial proposal.



Colin Guthrie

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

More information about the pulseaudio-discuss mailing list