In the game’s main loop, I call FMOD::System::setListenerAttributes each frame
Sound can be played correctly
When I make a phone call to the iOS device, it triggers applicationWillResignActive,
and the next call to FMOD::System::setListenerAttributes blocks
After the phone call finished, the application just freezes, if you pause it in xcode, you can see it hangs inside FMOD::System::setListenerAttributes call
When the application receive an interruption notification please call System::mixerSuspend, then when complete call System::mixerResume. This will allow FMOD to correctly shutdown and restart the audio systems to allow the phone call without losing any state.
Is there anything else one needs to do besides resume and suspend when closing and opening the app? I ask because most of the times, it works for me for my app but for 1 out of 10 times, the sound does not start playing again when I open the app again bring it back from sleep, but then I just close the app and open it again and the music starts playing again. Thanks!
Well… I found a quasi solution… I found that in the times when I call resume and it does not do anything, the must that reports itself as playing does not move forward in time. Therefore, I can just check if the music has move forward in time and if it has not, then I just suspend and resume again. Then, after calling it over and over for a few times, it seems to reboot the music in the few times when the music does not start automatically. Quite a fun hack. Is there any way I can get around this without the hack that you know of? If not, no worries. Thanks!
There is a known issue where the OS says the interruption is over too early when transitioning from the background. If you delay the execution of mixerResume by a couple of seconds it should avoid the problem. Perhaps this is what you are seeing?