开发者

Am I using CocosDenshion correctly?

I have found a tonne of leaks in my code. All of them come about when I play a sound or a song.

Here is how I call a sound effect:

 [[SimpleAudioEngine sharedEngine] playEffect:@"myeffect.wav"];

Here is how I play a song:

 [[SimpleAudioEngine sharedEngine] playBackgroundMusic:开发者_StackOverflow社区@"mysong.mp3"];

Am I somehow supposed to be releasing these after they are finished or something?


To get the memory back, you need to call unloadEffect: on the SimpleAudioEngine.

See http://www.cocos2d-iphone.org/api-ref/latest-stable/interface_simple_audio_engine.html#a1f3f121b3664c6b5bcfc33c8af63e52c


You are using it right. Are you sure you have a memory leak? SimpleAudioEngine will cache the audio file you play, for subsequent plays, so maybe that's why you see the memory increase and not decrease afterwards.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜