I have my app setup where when its audio is interrupted by another app (like a phone call), my app will automatically pause any audio.
In my app I have an FMOD::Studio::System instance, and FMOD::System instance, and an FMOD::Studio::EventInstance instance:
FMOD::Studio::System *studio_system_; FMOD::Studio::EventInstance *event_instance_; FMOD::System *low_level_system_;
On an audio interruption in iOS I am making the following calls:
event_instance_->setPaused(true); studio_system_->update(); low_level_system_->mixerSuspend()
When the user wants to resume the audio, the app makes these calls:
event_instance_->setPaused(false); studio_system_->update(); low_level_system_->mixerResume()
Everything is almost working perfectly except that when the audio is resumed there appears to be a stutter of the audio. It sounds as if the audio is resumed, paused for a split second, and then resumed again.
I don’t know exactly what’s causing the stutter, but the documentation for
mixerSuspend said that it saves the current internal state. I’m wondering if maybe the state of the audio being paused is not being processed before
mixerSuspend caches the state. So, I tried replacing calls to
studio_system_->flushCommands() but that also doesn’t work.
What am I doing wrong? Why am I getting this audio stuttering?