如何在Cocos2d中播放.aac
文件?
答案 0 :(得分:1)
使用CocosDenshion。但是,您可能希望将音频文件转换为AAC编码的* .caf格式,因为这是首选格式。
#import "SimpleAudioEngine.h"
//preloading is important. do it in the scene init function
[[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"MyBgMusic.caf"];
[[SimpleAudioEngine sharedEngine] preloadEffect:@"MyEffect.caf"];
//later on
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"MyBgMusic.caf"];
[[SimpleAudioEngine sharedEngine] playEffect:@"MyEffect.caf"];
完整文档在此处:http://www.cocos2d-iphone.org/api-ref/0.99.5/interface_simple_audio_engine.html
答案 1 :(得分:0)
看看下面的书;你会明白的。