Is input recording supported on Android ?

System.getRecordNumDrivers seems to be returning 0 for both numdrivers and numconnecteddrivers

This is on lowend semi-recent Andoird 5.1 phone, but was reported to not work on Galaxy 8, too for example.
I think I’ve never got this to work in the past.

[ I was lowering system’s dsp buffer sizes via setDSPBufferSize to 64 before init in order to reduce latency, but leaving them at default didn’t help in case of phone #1.
Apart from this there’s nothing going on before the getRecordNumDrivers call (i.e. just System_Create and normal init) and the call is being checked several times at this stage to give FMOD some time]

Are you set relevant permissions in your AndroidManifest.xml file?

“to make use of the System::recordStart API use android.permission.RECORD_AUDIO.”

https://fmod.com/resources/documentation-api?page=content/generated/platform_android/basics.html#/

Hi Cameron, thanks for reply

According to Unity’s documentation the required permission should be included automatically if .e.g Microphone class is used. I did that by just enumerating all available Microphone.devices in the code and checked the manifest of the resulting apk on the device (using an app from the store) - the required permission is there.

Unity’s Microphone class (Unity 5.5.4p5) lists one available device as ‘Android audio input’ with id 0, but getRecordNumDrivers reports 0 available/connected drivers still.
When I omitted the call and tried to get rec rate and channels for driver 0 nevertheless I got
system.getRecordDriverInfo ERR_INVALID_PARAM returned.

Note this is Android 5.1 - I’ll try to find out what happens on newer OS with permission included.

Not relying on Unity’s manifest generation, not using any of its Microphone calls and providing custom AndroidManifest.xml file with android.permission.RECORD_AUDIO user permission included yields, unfortunately, the same results.

It sounds like the Output is being set to AudioTrack by default, which does not support recording. We do try to detect devices that can use OpenSL and use that when possible but because of the variety of device hardware it can be difficult to determine.

You can use System::setOutput, before System::init, to manually change the Output to OpenSL, although not all devices do support it.

https://www.fmod.com/docs/api/content/generated/FMOD_System_SetOutput.html

1 Like

This helped, thanks!
And thanks for explanation, the situation on Android is indeed… varying.