Recording\Playing audio directly with libmedia\AudioFlinger

1.8k views Asked by At

I'm checking out the possibility of interfacing directly to libmedia\AudioFlinger for playing\recording raw audio (like AudioTrack\AudioRecord do).

The purpose is to workaround the minimum buffer size limitation of those 2 Java classes. I know that 2.3 introduces OpenSL, but I want to do that for 2.2 and below.

Has anyone done that before? Is there any good reference implementation that uses that? If not, how would you approach linking against this library and using it to workaround the minimum buffer size?

Thanks

1

There are 1 answers

0
Mathew Block On

Unfortunately there are only two supported audio APIs available, and you have mentioned both (AudioTrack and OpenSL). Any lower level than that and you would be interfering with the audio mixing already being done by the device for things like SFX and phone calls. Also as there is no API for lower layer audio you would need to go hacking, which probably isn't what you want to do for obvious compatibility reasons.