I’m experiencing an issue with my Unity game on Android. The idea is that the game will record your microphone’s input. Currently, everything’s working fine on Windows using an external mic. However, I’m unable to get any input from an Android phone’s internal mic.
I’ve already gone ahead and added android.permission.RECORD_AUDIO to the AndroidManifest. The mic permission prompt shows up fine when I start up the game.
Using getRecordDriverInfo(), I printed details of any found input driver. However, I only found 1 audio output driver instead of any input driver:
Input driver 0: Android audio output (ffffffff-ffff-ffff-ffff-ffffffffffff), sampleRate=48000, STEREO (2 channels) -- CONNECTED, DEFAULT (connected? True)
And later, we print the same driver for the output too:
Output driver 0: Android audio output (00000000-0000-0000-0000-000000000000), sampleRate=48000, STEREO, 2 channels
Contrast this to this working on a regular Windows machine:
Input driver 0: Microphone (HD Pro Webcam C920) (765b9694-d308-4b69-942b-978e654777e6), sampleRate=16000, STEREO (2 channels) -- CONNECTED, DEFAULT (connected? True)
I’m calling FMODUnity.RuntimeManager.CoreSystem.recordStart(m_InputDriverId, m_Sound, true); after the statements above.
I’m not receiving any runtime errors and everything else seems to be initializing successfully. Additionally, I experimented with placing the following line in the initialization stage, but to no effect:
I’m using an LG V35 with Android 10, by the way. I’ve tested on multiple devices.
I’d appreciate if someone could lead me in the right direction. If you need any more information, I’d be happy to provide. Thanks!
[update]: After further testing, I noticed that even after I setOutput to OpenSL, the change doesn’t seem to stick. I called
FMODUnity.RuntimeManager.CoreSystem.getOutput(out temp); directly after setting the output and received “AAUDIO” instead of “OPENSL”. I placed the getOutput a little ways down the execution line in case it needed time to adjust, but it stuck with “AAUDIO”.