Crash on Microphone.Start() in AudioManager::getRecordPosition()

Hi guys,

since weeks I’m trying to find out what makes our game crash when we try to start the microphone on iOS 7.1 (iPad)

Using XCode 5.1 and Unity Pro 4.3.4f1

It seems to crash at this point:

audio.clip = Microphone.Start(selectedDevice, true, 10, maxFreq);

selectedDevice is null, so the default microphone should be used. “Built-in Microphone” doesn’t work either.
The xcode debugger shows

Starting Microphone failed. result=57 (A call to a standard soundcard driver failed, which` could possibly mean a bug in the driver or resources were missing or exhausted. )

/Applications/buildAgent/work/d3d49558e4d408f4/Runtime/Audio/AudioManager.cpp line 1481]


#0	0x017c2f64 in FMOD::SystemI::getRecordPosition(int, unsigned int*) ()
#1	0x017bae70 in FMOD::System::getRecordPosition(int, unsigned int*) ()
#2	0x0164fe74 in AudioManager::GetRecordPosition(int) const at /Applications/buildAgent/work/d3d49558e4d408f4/Runtime/Audio/AudioManager.cpp:1637
#3	0x01661bcc in Microphone_CUSTOM_GetPosition(ICallString) at /Applications/buildAgent/work/d3d49558e4d408f4/artifacts/iPhonePlayer-armv7Generated/AudioBindings.cpp:1490
#4	0x0087de08 in m_7b8 ()

My StartMic function looks like

public void startMicrophone(){
	audio.clip = Microphone.Start(selectedDevice, true, 10, maxFreq);
	audio.loop = true;
	audio.mute = true;
	while (!(Microphone.GetPosition(selectedDevice) > 0)){}

And in my Update() I try this to give the microphone startup a little time:

void Update(){
  if( audio.isPlaying == false && Microphone.GetPosition( selectedDevice ) > 0 && audio.clip != null ){

Sometimes it works perfectly but most of the times the app crashes.

Does anybody know how to fix this?

Best regards,

try yield return Application.RequestUserAuthorization(UserAuthorization.Microphone); in your start function, you may need user’s permission to run the microphone. It works for me, i don’t know whether it will work for you.

I have the same problem, but the problem only occurs when using the Microphone and minimizing the app and resuming it again as fast as I possibly can. Then the audiodriver (or something) seem to bail out and all audio in the app is gone after that.

Have not found any solution to this yet.