* Help! Need to switch between normal speaker and BT headset dynamically
@ 2010-04-04 15:50 Pradeep Kumar Jilagam
2010-04-04 19:36 ` Daniel Chen
0 siblings, 1 reply; 6+ messages in thread
From: Pradeep Kumar Jilagam @ 2010-04-04 15:50 UTC (permalink / raw)
To: alsa-devel
Hi,
I am trying to switch the ALSA audio output between default speaker and
BT(BlueTooth) headset.
For this, I have used the bluez stack for the BT headset scanning and
detection. After this, I have updated the .asoundrc file with the
corresponding details(like MAC address of the detected BT headset and the
device type as "pcm.bluetooth"). And finally, I used the aplay utility to
play the file.
This approach works fine but this needs restart of the playback session to
start routing on the BT headset. I am trying for a
solution(application/plugin) that can dynamically set the BT headset as the
default audio output device and start streaming to it automatically as soon
as the BT headset is detected in the middle of audio playback.
Is this possible to do and if yes, is there an ALSA application/plugin
already available for this?
Thanks,
Pradeep
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help! Need to switch between normal speaker and BT headset dynamically
2010-04-04 15:50 Help! Need to switch between normal speaker and BT headset dynamically Pradeep Kumar Jilagam
@ 2010-04-04 19:36 ` Daniel Chen
2010-04-06 5:06 ` Pradeep Kumar Jilagam
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Chen @ 2010-04-04 19:36 UTC (permalink / raw)
To: Pradeep Kumar Jilagam; +Cc: alsa-devel
On Sun, Apr 4, 2010 at 11:50 AM, Pradeep Kumar Jilagam
<pradeep.jilagam@gmail.com> wrote:
> Is this possible to do and if yes, is there an ALSA application/plugin
> already available for this?
e.g., PulseAudio?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help! Need to switch between normal speaker and BT headset dynamically
2010-04-04 19:36 ` Daniel Chen
@ 2010-04-06 5:06 ` Pradeep Kumar Jilagam
2010-04-06 8:19 ` Colin Guthrie
0 siblings, 1 reply; 6+ messages in thread
From: Pradeep Kumar Jilagam @ 2010-04-06 5:06 UTC (permalink / raw)
To: Daniel Chen; +Cc: alsa-devel
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. 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.
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. I am trying to find out whether it is possible to do so
and also whether there is any plugin/application available for it.
Thanks,
Pradeep
On Mon, Apr 5, 2010 at 1:06 AM, Daniel Chen <seven.steps@gmail.com> wrote:
> On Sun, Apr 4, 2010 at 11:50 AM, Pradeep Kumar Jilagam
> <pradeep.jilagam@gmail.com> wrote:
> > Is this possible to do and if yes, is there an ALSA application/plugin
> > already available for this?
>
> e.g., PulseAudio?
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help! Need to switch between normal speaker and BT headset dynamically
2010-04-06 5:06 ` Pradeep Kumar Jilagam
@ 2010-04-06 8:19 ` Colin Guthrie
0 siblings, 0 replies; 6+ messages in thread
From: Colin Guthrie @ 2010-04-06 8:19 UTC (permalink / raw)
To: alsa-devel
'Twas brillig, and Pradeep Kumar Jilagam at 06/04/10 06:06 did gyre and
gimble:
> 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.
HTHs
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
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/]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help! Need to switch between normal speaker and BT headset dynamically
@ 2010-04-06 11:37 ANISH KUMAR
2010-04-06 14:30 ` Colin Guthrie
0 siblings, 1 reply; 6+ messages in thread
From: ANISH KUMAR @ 2010-04-06 11:37 UTC (permalink / raw)
To: alsa-devel@alsa-project.org; +Cc: maniyar, gmane
As my question is related to the query what pradeep is asking and mark brown also suggested to me to use PA.
I have some additional questions regarding PA which i would like to clarify before starting:
1.Does PA have good resampler code if my hardware doesn't support resampling?
I have a system where we are using ALSA as the base and on top(application side) of it there is a thread running which
is pumping data and this thread is started by java code.Combination of LINUX+JAVA.
This thread can perform these tasks:
1.Resampling for some rates.
2.Talking to PV framework to get the decoded PCM data and pumping audio data to alsa.
3.Routing support using asound.conf file.
Can i replace this thread with PA by writing some wrapper over PA??
What extra features PA is going to provide additionally if i start using PA other than what is listed above??As i know
PA is kind of sound deamon which my thread is not.
Is there any good resampler code which i can use without any licensing problem and which can be
easily integrated???
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help! Need to switch between normal speaker and BT headset dynamically
2010-04-06 11:37 ANISH KUMAR
@ 2010-04-06 14:30 ` Colin Guthrie
0 siblings, 0 replies; 6+ messages in thread
From: Colin Guthrie @ 2010-04-06 14:30 UTC (permalink / raw)
To: alsa-devel
'Twas brillig, and ANISH KUMAR at 06/04/10 12:37 did gyre and gimble:
> As my question is related to the query what pradeep is asking and mark brown also suggested to me to use PA.
> I have some additional questions regarding PA which i would like to clarify before starting:
>
> 1.Does PA have good resampler code if my hardware doesn't support resampling?
Yes. Infact this code will likely be needed in several cases when the
h/w does support resampling. If PA has multiple streams playing at once,
the h/w will likely only be able to cope with one rate at a time.
The resamplers are pluggable and can have optimized implementation for
some hardware - e.g. I believe Palm wrote an ARM specific resampler to
do this for their Pre platform (I could be mis-remembering tho').
> I have a system where we are using ALSA as the base and on top(application side) of it there is a thread running which
> is pumping data and this thread is started by java code.Combination of LINUX+JAVA.
> This thread can perform these tasks:
> 1.Resampling for some rates.
> 2.Talking to PV framework to get the decoded PCM data and pumping audio data to alsa.
> 3.Routing support using asound.conf file.
> Can i replace this thread with PA by writing some wrapper over PA??
> What extra features PA is going to provide additionally if i start using PA other than what is listed above??As i know
> PA is kind of sound deamon which my thread is not.
One very interesting feature of PA that is particularly relevant to
mobile platforms is the use of a timer-based model to drive the hard
ware. This allows for very large latencies to be used (e.g. 10-20s)
allowing for very efficient processor usage - only waking up when
absolutely necessary, not to service interrupts.
More info:
http://0pointer.de/blog/projects/pulse-glitch-free.html
This approach can bring power savings and thus increased battery life.
> Is there any good resampler code which i can use without any licensing problem and which can be
> easily integrated???
I pretty sure the included resamplers are OK to use, but it's all
clearly documented so just take a look.
Like I say it's easy enough to include your own too if needs be.
Col
--
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/
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/]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-04-06 14:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-04 15:50 Help! Need to switch between normal speaker and BT headset dynamically Pradeep Kumar Jilagam
2010-04-04 19:36 ` Daniel Chen
2010-04-06 5:06 ` Pradeep Kumar Jilagam
2010-04-06 8:19 ` Colin Guthrie
-- strict thread matches above, loose matches on Subject: below --
2010-04-06 11:37 ANISH KUMAR
2010-04-06 14:30 ` Colin Guthrie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).