[alsa-devel] Help! Need to switch between normal speaker and BT headset dynamically

Colin Guthrie gmane at colin.guthr.ie
Tue Apr 6 10:19:16 CEST 2010

'Twas brillig, and Pradeep Kumar Jilagam at 06/04/10 06:06 did gyre and
> Hi Daniel,
> Thanks for your response.
> I am trying to get this working on a small embedded system with limited
> memory and processing capabilities. I have also explored in the direction of
> pulseaudio but I am not sure whether it is small enough to fit into a small
> system.

Most of the linux-based embedded and mobile phone manufacturers are
using PA these days (certainly Palm, Nokia and Intel), so I don't see a
major headache here. There are specific optimisations for ARM in the PA
codebase too.

 Aslo, I I came to know that the default output device will again
> have to be manually changed in the GUI menu fo pulseaudio to start streaming
> on the BT headset after updating asoundrc with its MAC address.

Using the ALSA bluetooth support is likely not going to work too well.
PA has direct bluetooth support these days. All the upstream (bluez)
effort regarding audio on linux is via PA. PA will automatically
discover BT devices and once they are paired, they will appear
automatically as sinks/sources in PA.

You can use various command line tools to change the device of a running
stream. You can also write a program and use the libpulse capabilities
to programatically move the streams.

> I am trying to find out whether the streaming can automatically start
> routing to the BT headset as soon as it is detected without any need for
> user's intervention.

In theory yes, but in practice this is actually quite hard with the
current PA routing logic. I personally have some issues with it and want
to change things to make this use case easier.

Currently if all audio streams are tagged as "media.role=phone" then
they *will* be routed to a bluetooth device automatically if one is
present. So that's probably the cleanest approach.




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 Alsa-devel mailing list