1

I am using FMOD for iPhone to generate a tone and play it, but when the iPhone locks the sound pauses. This is not the desired behavior, and only recently popped up. I hadn't tested it in awhile, but the only thing that I think changed since last time was that I updated to iOS 5.

I made sure to set the FMOD session to

FMOD_IPHONE_SESSIONCATEGORY_MEDIAPLAYBACK

and the AudioSession category to

kAudioSessionCategory_MediaPlayback

I double checked in both the AudioSession and FMOD documentations that nothing had changed. I also made sure that I had the most recent version of the FMOD SDK. Any help would be appreciated to fix this issue.

Thanks

4

1 回答 1

2

通过 extradriverdata 指定 FMOD_IPHONE_SESSIONCATEGORY_MEDIAPLAYBACK 就足以确保在设备锁定时播放音频。我已经在 iOS 5 上对此进行了测试,并且可以确认它确实有效。请注意,这与在后台播放音频是分开的。

我注意到您提到了 kAudioSessionCategory_MediaPlayback,这让我觉得您正在使用本机音频会话 API。我强烈反对这样做,在 FMOD 之外初始化音频会话可能会导致问题。

我建议删除任何本机音频 API 调用,并在锁定时重新测试音频播放。

于 2011-11-27T22:51:05.187 回答