- Home /
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]
StackTrace
#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 ){
audio.Play();
}
}
Sometimes it works perfectly but most of the times the app crashes.
Does anybody know how to fix this?
Best regards, Robert
nothing? the interesting thing is, that the app doesn't crash if no other unity scene has been loaded before the scene with the microphone. So when I start the app with the microphone scene first, it works.
hope somebody has an idea :) robert
same issue here. I've noticed it happens more often when I'm debugging from xCode. then if I run without xCode it usually doesn't happen.
update: well... it doesn't crash, but it completely stops the audio driver (no sound after that). I can also reproduce it consistently now. it's happens every time after using videoTexture via plugin (either prime31 liveTexture or video texture pro 2.0) I tried it on both. crash every time.
Answer by glenn-dai · May 07, 2015 at 06:42 AM
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.
Answer by bobmoff · Aug 24, 2015 at 12:43 PM
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.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
A node in a childnode? 1 Answer
Object Reference Not Set As Instance error from ngui code 1 Answer
Need help working with NGUI progress bar 2 Answers