I am compiling against a library that creates an AudioRecord object that captures the microphone input of my tablet.
I don't have the ability to modify the precompiled library, but I want to feed it some pre-recorded audio.
Is there a way to create some sort of loopback in android to accomplish this?
Android does not (at the time of writing) support this functionality. You as an app developer can't replace the microphone path with some other audio source.
Some platforms do support this kind of functionality. For example, I've done loopback of audio on Qualcomm's APQ8064 platform by connecting one of the
MultiMedia DAIs to the
AFE_PCM_RX audio mixer, and the
AFE_PCM_TX DAI to the
MultiMedia audio mixer, and then reading from the
AFE_PCM_TX device. But this is obviously very platform-specific, it requires you to have a rooted device (and possibly access to the full source code for the device so that you can make a custom ROM), and a good understanding of the platform in question.
TL;DR: it's generally not worth the effort to attempt this.