【已解决】cocos2dx 2.1.4 添加 音乐怎么没声音啊

#include “HelloWorldScene.h”
#include “AppMacros.h”
#include “SimpleAudioEngine.h”
USING_NS_CC;

CCScene* HelloWorld::scene()
{
// ‘scene’ is an autorelease object
CCScene *scene = CCScene::create();

// 'layer' is an autorelease object
HelloWorld *layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;

}
// on “init” you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}

//添加音乐
CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(“Sounds/KSLoading1.ogg”);
CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic(“Sounds/KSLoading1.ogg”, true);

return true;
}

void HelloWorld::menuCloseCallback(CCObject* pSender)
{
CCDirector::sharedDirector()->end();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
}

我就加了
#include “SimpleAudioEngine.h”
//添加音乐
CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(“Sounds/KSLoading1.ogg”);
CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic(“Sounds/KSLoading1.ogg”, true);

就是没声音发出来 是不是我哪里还漏了什么 求大神指点!

ogg音效文件在windowsPC上貌似是不能播放出来。但是当你编译到安卓上时是能正常播放的。

可是在 cocos2dx 的实例文件上都有声音的。

有的能播,有的不行
我记得我测试的时候有的wma格式可以播放有的不可以,你可以换个别的ogg试试,或吧例子中的复制过去试试
wma本身也有很多种格式,用格式转换器,把ogg的格式转成几种在试试

谢谢了 的确和你所说的一样