开发者

How to play .aac file in Cocos2d?

开发者 https://www.devze.com 2023-02-05 15:23 出处:网络
How can play an .aac开发者_运维百科 file in Cocos2d?Use CocosDenshion. However, you may want to convert your audio files to AAC encoded *.caf format, as that is the preferred format.

How can play an .aac开发者_运维百科 file in Cocos2d?


Use CocosDenshion. However, you may want to convert your audio files to AAC encoded *.caf format, as that is the preferred format.

#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"];

Full documentation is here: http://www.cocos2d-iphone.org/api-ref/0.99.5/interface_simple_audio_engine.html


Take a look at following book; you will get idea.

Adding Audio

0

精彩评论

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