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]
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.