Hi,
I have been researching about audio and all the examples I could found are with SimpleAudioEngine which I believe is deprecated in last version in favor of AudioEngine.
I find it a bit confusing compared with SimpleAudioEngine where you simple created an audio instance (CocosDenshion::SimpleAudioEngine::getInstance()) and then operate on with playEffect() for instance.
With AudioEngine class as far as I can tell you don’t create any instance. There is no method such as getInstance() correct. So this is what I have:
#include "HelloWorldScene.h"
#include "AudioEngine.h"
USING_NS_CC;
Scene* HelloWorld::createScene()
{
return HelloWorld::create();
}
bool HelloWorld::init()
{
if ( !Scene::init() )
return false;
// The background music
int audioId1 = AudioEngine::play2d("sapMix.mp3", true, 1.0f);
// The effect
AudioEngine::preload("laserSound.mp3");
int audioId2 = AudioEngine::play2d("laserSound.mp3");
return true;
};
I know this code is not much, but it’s better than nothing. So, is there another audio class that I should be using for effects? I am a bit lost right now.
thanks