My users are starting to update to iOS 17, and it appears Apple included a nice new bug in Core Audio for this release. Yay!
Weirdly, the issue only begins when audio is not playing back; my app is a music generation/playback app, so stopping/starting playback happens all the time.
Some time (usually one to several seconds) after calling FMOD::System->mixerSuspend()
I get this error in the Xcode logs:
connection <connection: 0x11bd294f0> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 } : error <dictionary: 0x23aecadc0> { count = 1, transaction: 0, voucher = 0x0, contents =
"XPCErrorDescription" => <string: 0x23aecafb0> { length = 22, contents = "Connection interrupted" }
}
Type: Error | Timestamp: 2023-09-22 07:50:32.614689-07:00 | Library: libAudioToolboxUtility.dylib | Subsystem: com.apple.coreaudio | Category: AQClient | TID: 0xd53cf
auto-cancelling <connection: 0x11bd294f0> { name = com.apple.audio.AudioQueueServer, listener = false, pid = 0, euid = 4294967295, egid = 4294967295, asid = 4294967295 }
Type: Error | Timestamp: 2023-09-22 07:50:32.614901-07:00 | Library: libAudioToolboxUtility.dylib | Subsystem: com.apple.coreaudio | Category: AQClient | TID: 0xd53c
At this point, calling FMOD::System->mixerResume()
yields a FMOD_ERR_OUTPUT_INIT
result: “Error initializing output device.” The FMOD debug log shows this:
[LOG] SystemI::mixerResume : Resuming output.
[ERR] OutputCoreAudio::suspend : Cannot start audio unit. (err: -50)
To be clear, I am all but convinced this is totally Apple’s fault and not something FMOD is responsible for. Case in point, setting AVAudioSession immediately after the first error above puts this in the logs:
AVAudioSessionUtilities.h:196 Invalid XPC connection, session ID = 0x0, property ID = AudioCategory
Type: Error | Timestamp: 2023-09-22 07:50:33.479027-07:00 | Library: AudioSession | Subsystem: com.apple.coreaudio | Category: as_client | TID: 0xd42d
(Although, interestingly, after the failed attempt to resume FMOD I am once again able to set AVAudioSession without issue. Not that it does me any good, mind you.)
Anyway, I am tearing my hair out trying to come up with a workaround for this issue. Wanted to post this just in case someone had any ideas of where to go from here, but mostly so that any other programmers using FMOD are affected by this issue know: it’s not just you!