开发者

cocos2d music preload

how i can preload mp3 background music file async in cocos2d? Like textures

        [[CCTextureCache sharedTextureCache] addImageAsync:@"textures.png" target:self selector:@selector(textureLoaded:)];     

i search only this solution

 SimpleAudioEngine *sae = [SimpleAudioEngine sharedEngine];
if (sae != nil) {
    [sae preloadBackgroundMusic:@"mula_tito_on_timbales.mp3"];
    if (sae.willPlayBackgroundMusic) {
        sae.backgroundMusicVolume = 0.5f;
开发者_StackOverflow社区    }
}


You can't preload background music asynchronously using SimpleAudioEngine functions. The solution you posted will still work, though, as the SimpleAudioEngine data persists between cocos2d scenes.

If you really want it to be asynchronous, you could do it in a separate thread, or an NSOperation. This thread on the cocos2d forums has a number of suggestions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜