Some months ago, with Android ICS (4.0), I developed an android kernel module which intercepted the "pcmC0D0p"-module to fetch all system audio.
My target is to stream ALL audio (or at least the played music) to a remote speaker via AirPlay.
The kernel module worked, but there where several problems (kernel-versions, root-privileges etc.) so I stopped working on this.
Now, we have Android 4.1 and 4.2 and I have new hope!
Who has an idea how to capture the audio in Android?
I had following ideas:
Connect via bluetooth to the same phone, set routing to BT and grab the audio on the "other end": this shouldn't work
Intercept the audio with a kernel module like done before: hardcore, get it worked but not applicable
JACK Audio Connection Kit: sadly Android uses "tinyALSA" and not "ALSA". TinyALSA does NOT support any filters like JACK (but this brought the idea with the kernel module)
Use PulseAudio as a replacement for AudioFlinger, but this is also not applicable
EDIT (forgot them):
I compiled "tinymix" (baby-version of ALSA-mixer) from tinyALSA (the ALSA on Android) and tried to route the audio-out to mic-in - but with no success (not understandable for me). And this also needs rooting: not applicable
I tested OpenSL ES, but I'm not a C-crack and it ended in "I can record microphone, but no more" (maybe I was wrong?)
I just found ROUTE_TYPE_LIVE_AUDIO:
A device that supports live audio routing will allow the media audio stream to be routed to supported destinations. This can include internal speakers or audio jacks on the device itself, A2DP devices, and more.
Once initiated this routing is transparent to the application. All audio played on the media stream will be routed to the selected destination.
Maybe this helps in any way?
I'm running out of ideas but want to "crack this nut", maybe someone can help me?
EDIT:
I'm really new in C & kernel-coding (but I successfully created a cross-compiled audio-interception-module) - but isn't it in any way possible to listen at the point the PCM-data goes from userspace (JAVA, C-layer?) to the kernel-space (tinyALSA, kernel-module), without hacking & rooting?