[pulseaudio-discuss] Switching devices by application
Patrick Ben Koetter
p at state-of-mind.de
Sat Oct 16 14:11:46 PDT 2010
* Colin Guthrie <pulseaudio-discuss at mail.0pointer.de>:
> 'Twas brillig, and Patrick Ben Koetter at 11/10/10 10:34 did gyre and
> gimble:
> > I seek advice configuring my PulseAudio setup on my Ubuntu Desktop. What I
> > want is use my headphone for phone calls (using BRIA SIP client for Linux) and
> > the soundcard to listen to music.
>
> When you say your "headphone", do you mean a specific separate device
> (e.g. a USB or Bluetooth headset) or just the headphone port of your
> built in sound card?
>
> > Both devices should work separately and automated i.e. when a phone call comes
> > in don't switch manually from soundcard to headphone etc., but have it
> > assigned to the headphone automatically.
> >
> > The people who produce BRIA told me, it is out of their SIP client's control
> > to trigger/control which device should be used and told me this needs to be
> > configured in my PulseAudio server instead.
> >
> > I looked up the documentation, but could figure out if and how it would be
> > done in PulseAudio.
> >
> > Any help would greatly be appreciated.
>
>
> The answer of "how to do this" depends a bit on your Desktop. e.g. in
> KDE it's a little different than on Gnome (although the principle is the
> same).
>
> There are also a couple things the BRIA people *can* do to make the
> process work properly.
>
> In the short term, all you really need to do is use pavucontrol.
>
> When your SIP client is running and has an active call, pavucontrol
> should show you two streams for this application - one for playback and
> one for recording. These will be shown on the first two tabs in pavucontrol.
>
> All you need to do is set the right device for the streams - i.e. move
> them from the default/fallback device to the headset device. You will
> need to do this for both your recoding stream and the playback stream.
>
> Once you have done this once, PA will remember this decision and restore
> it next time (assuming the device is plugged in!).
>
>
> The UIs built into Gnome itself are somewhat lacking in the control
> regard in this base and attempt to be more "intelligent" without you
> having to do anything.
>
> This is where the BRIA people can be nice and provide suitable metadata
> when they output audio. Every stream in PA can have a "proplist"
> basically a list of key-value pair metadata. One of the properties you
> can set is the media.role property. The sound of a phone ringing and
> presense information changing etc. (i.e. all non-call sound) should
> likely be tagged with media.role=event. All in-call sound (playback and
> recording) should have media.role=voip. Skype, for example, correctly
> tags it's streams in this way on our recommendation.
>
> When this metadata is present, PA can do some clever, contextual things,
> e.g. if you have a device plugged in that is detected as a "headset", PA
> can be a bit clever and say... "hmmm there is a phone call currently
> underway, and I have a headset device... the two should probably work
> together". This logic is currently implemented by module-intended-roles
> which is loaded by default.
>
> So, while the BRIA people are correct that they do not actively control
> the devices (which we recommend) they can supply suitable metadata to
> help us make the right decision automatically (which can still be
> overridden by user preferences :))
This is what they answered:
We've not assigned a media role to the PulseAudio streams because we need to
identify between headset/speakerphone. If we were to set a "media.role=phone"
or "media.role=voip",
+Pulseaudio would assign the device based on this and our own speakerphone
toggle would not work (because both headset and speakerphone would have the
same media role and
+PulseAudio thus will use the same device for both).^M
^M
For this reason, what we've done instead is give each stream a name eg. Bria
Headset Output, Bria Headset Input, Bria Speakerphone Output, Bria
SpeakerPhone Input and Bria
+Ringer. Using pavucontrol allows the user to select the device for each of
these streams and PulseAudio will remember it based on the stream name (since
we don't have a media
+role set, stream name is used for device selection). ^M
^M
The streams only show up in Pavucontrol when Bria is actually playing them so
that's when the user can choose the device.^M
HTH,
p at rick
> I've not gone into too much detail here, but hopefully it's enough
> information to get your setup correct, but I'd appreciate it if you
> could pass on a link to this thread
> (http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/7596) to
> the BRIA guys who are welcome to get in touch for more info/advice.
>
> All the best
>
> Col
--
state of mind
Digitale Kommunikation
http://www.state-of-mind.de
Franziskanerstraße 15 Telefon +49 89 3090 4664
81669 München Telefax +49 89 3090 4666
Amtsgericht München Partnerschaftsregister PR 563
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3603 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20101016/792e63f5/attachment.bin>
More information about the pulseaudio-discuss
mailing list