문제

I'm playing short aiff sounds using the AVAudioPlayer class while doing animations. Unfortunately, every time a sound plays the frame rate of the animation drops. It seems this can be fixed by setting the AVAudioSession category to AVAudioSessionCategorySoloAmbient, but despite having done this, I'm still seeing a lot of frame rate drops.

I'm settings the AVAUdioSession category in the app delegate like this:

NSError *setCategoryError = nil;
BOOL success = [[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategorySoloAmbient error: &setCategoryError];

Am I doing something wrong here?

도움이 되었습니까?

해결책

I am assuming your AVAudioPlayer instance is on the main thread. Move the AVAudioPlayer instance to its own thread. Graphics rendering performance will improve as a result.

Your applications audio session singleton should have no, or at most very minimal, effect with respect to your animation issue. (as you pointed out by ensuring it is set to a non-mixable category)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top