Iphone cocos2d音乐预加载
如何在cocos2d中异步预加载mp3背景音乐文件?相似纹理Iphone cocos2d音乐预加载,iphone,cocos2d-iphone,mp3,simpleaudioengine,Iphone,Cocos2d Iphone,Mp3,Simpleaudioengine,如何在cocos2d中异步预加载mp3背景音乐文件?相似纹理 [[CCTextureCache sharedTextureCache] addImageAsync:@"textures.png" target:self selector:@selector(textureLoaded:)]; 我只搜索这个解决方案 SimpleAudioEngine *sae = [SimpleAudioEngine sharedEngine]; if (sae != nil) {
[[CCTextureCache sharedTextureCache] addImageAsync:@"textures.png" target:self selector:@selector(textureLoaded:)];
我只搜索这个解决方案
SimpleAudioEngine *sae = [SimpleAudioEngine sharedEngine];
if (sae != nil) {
[sae preloadBackgroundMusic:@"mula_tito_on_timbales.mp3"];
if (sae.willPlayBackgroundMusic) {
sae.backgroundMusicVolume = 0.5f;
}
}
不能使用SimpleAudioEngine函数异步预加载背景音乐。不过,您发布的解决方案仍然有效,因为SimpleAudioEngine数据在cocos2d场景之间持续存在 如果您确实希望它是异步的,您可以在单独的线程或NSO操作中完成。在cocos2d论坛上有许多建议