Audio Framework: stream, strategies, devices
I am trying to get a better understanding of android audio framework (froyo onwards in particular).
I've almost got the distinction into streams. The AudioFlinger maps each stream into a "strategy" and then routes a strategy to the proper "device" (BT, Headset, Speaker..)
However I still struggle to understand: 1) How multiple apps play onto the same stream? can they just 'play' or do they have to handle the focus (request, abandon and listen for changes)?
2) When multiple streams are playing...what is the priority of one stream respect to another? surely the in-call stream has top prior开发者_StackOverflowity but are there any "rules" to understand how things really work.
If anyone with more confidence on this matter has got any doc/resource to study.. it would be great.
Thanks! Marco
The answer to this question
Concurrent Sound on Android Device
may help you.
Also, here
http://www.droidnova.com/creating-sound-effects-in-android-part-1,570.html
is written how to initialize the SoundManager with the number of concurrent streams you want to play.
If you need to understand the default behavoiur you can see the Cplusplus code at
/hardware/libhardware_legacy/audio/AudioPolicyManagerBase.cpp
However each vendor can make changes and ship a different flavour
精彩评论