1

I have recently been adding sounds into a game I'm developing using AVAudioPlayer. I have noticed that playing sounds will often slow the game down in terms of framerate. I have tried to reduce the performance cost by using the method [sound prepareToPlay], however this seems to make no difference. Does anyone know a way to play sounds without a significant performance cost? Any help would be greatly appreciated.

1 Answer 1

3

AVAudioPlayer is very expensive performance-wise and has lag issues. It is also not very reliable in terms of leaks since you have to release it on the audioPlayerDidFinish callback of AVAudioPlayerDelegate delegate.

AVAudioPlayer is best for playing longer loop-able music tunes as a background. In order to play short sound effects it is performance-wise cheaper to use AudioServicesPlaySystemSound method from AudioToolbox.h. In order to do that you need to declare SystemSoundID..

you can refer this link.. http://blogs.x2line.com/al/archive/2011/05/19/3831.aspx

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.