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

Colin Guthrie gmane at colin.guthr.ie
Tue Apr 6 16:30:21 CEST 2010

'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:

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.



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