I am creating new app through which I will send audio data but I wanted some specific mixer controls to be used for this transfer of data.
So I wanted to add new device constant like AUDIO_DEVICE_OUT_SPEAKER (AUDIO_DEVICE_OUT_NEW) and make this device constant to get selected.
(creating above new constant is to differentiate it from other apps)
So that I will use this variable in HAL and will select new usecase created.
For above I need to find out who selects AUDIO_DEVICE_OUT_SPEAKER(or similar constants) and based on what conditions this constant gets selected, so that I can replicate the same for my newly created constant(AUDIO_DEVICE_OUT_NEW).
I searched in google, but very less information is available. Any suggestions/help will be really appreciated.
I am using kitkat source code.

- 400
- 1
- 2
- 19
1 Answers
The audio HAL is likely to differ for different platforms, and in some cases for different OEMs (I used to work on the audio HAL and framework at Sony, and we made some customizations to have routing consistent with earlier products, and to add Sony's own audio effects, etc).
Anyway, the audio HAL will typically include a policy manager, which makes high-level routing decisions based on the current use-case (voice call, music playback, notification playback), the accessories you've got attached, etc. In all implementations of the audio policy manager I've worked with, there's been a getDeviceForStrategy
method that performs this selection. Here's one implementation of that method, which you'll likely to find on some Qualcomm-based devices (perhaps with some customizations).
Note that simply adding a new AUDIO_DEVICE_OUT_
constant and selecting it under some condition in the policy manager isn't going to do you any good. You'll also have to do other changes in the HAL to map your new device to a set of parameters that enable the appropriate sound paths at the hardware level. See my earlier answer regarding creating alternate sound paths for a bit more information.
-
Hi Michael thanks for quick response. It was useful for me. I have already made the required changes(for my sound path) in HAL, I just need to differentiate it from other audio streams. I have found alternative solution for my problem. But I have a query in that solution too and I have posted it here http://stackoverflow.com/q/31705819/5164909 – Vijeth PO Jul 30 '15 at 06:07
-
@Michael do you have idea about this question ? https://stackoverflow.com/questions/62022159/how-the-mixer-thread-created-in-audio-filnger-and-how-the-mapping-is-done-betwee – Vishal Gupta Jun 03 '20 at 08:11