[iOS] Problems with mixerSuspend and mixerResume

,

Using fmod 2.03.07.

Calling mixerSuspend() when the app goes to the background sometimes shows an error in the logs, Cannot offline render audio queue. (err: -50). With or without that error, when the app comes back to the foreground, and calling mixerResume(), the audio track that was being played before the suspend is no longer heard (the track was created by createStream), and new sounds can’t be played.

If the app is put into the background and brought back to the foreground again, then sounds can be played. It just happens randomly.

Calling mixerSuspend():

[LOG] SystemI::mixerSuspend                    : Suspending output.
[ERR] CodecAudioQueue::readInternal            : Cannot offline render audio queue. (err: -50)
[LOG] Thread::callback                         : FMOD mixer thread finished.

Then calling mixerResume():

[LOG] SystemI::mixerResume                     : Resuming output.
[LOG] OutputCoreAudio::init                    : Hardware buffer size: 1024 samples, hardware sample rate: 48000Hz, hardware channels: 2
[LOG] OutputCoreAudio::init                    : Maximum hardware read size: 4096 samples, Software buffer size: 512 samples, Number of software buffers: 4.
[WRN] OutputCoreAudio::init                    : DSP buffer size * DSP num buffers is potentially too small.
[LOG] SystemI::startDriver                     : Output requires a sample rate of 48000Hz, resampling will occur.
[LOG] Thread::initThread                       : Init FMOD mixer thread. Affinity: 0x4000000000000001, Priority: 0xFFFF7FFA, Stack Size: 81920, Semaphore: Yes, Sleep Time: 0, Looping: Yes.

The sounds are created by using the following:

FMOD_CREATESOUNDEXINFO info{};
info.cbsize = sizeof(FMOD_CREATESOUNDEXINFO);
info.fileuseropen = fmod_file_open_callback;
info.fileuserread = fmod_file_read_callback;
info.fileuserseek = fmod_file_seek_callback;
info.fileuserclose = fmod_file_close_callback;

and depending on the size of the audio file (mp3), one of the following calls is used:

result = _fmodSystem->createSound(fullPath.c_str(), FMOD_2D, &info, &sound);

or

result = _fmodSystem->createStream(fullPath.c_str(), FMOD_2D, &info, &sound);

The fileuser callbacks are set in order to use a virtual file system.

The exact same code works correctly on Android, so this is something that seems to be specific to iOS.

Is there anything I should be calling or setting to avoid this issue on iOS?