Sound support

Sound support
0.0 0


I am using the latest build from the git repo. I noticed that the sounds play ok, but the repeat flag doesn’t seem to work reliably when playing samples.

Any suggestions?


Please, may you be a little more specific?
Which method are you talking about? Are you playing more than one sound at once?


I mean the call to

SimpleAudioEngine::sharedEngine()->playEffect(“sound.raw”, true);

And yes, I am playing more than 1 sound at once, I thought the latest patch fixed that. Is that correct?

Thanks again,


Ok, but I need some more details. Please, may you describe the issue?
Also are you using the supplied effect1.raw or are you using your own sound fx?



Hi Giovanni,

Let me explain myself better:

  • I am using the preloadSound and preloadBackgroundMusic methods, which I am not sure they are working corrctly, as it looks that preloading a sample overwrites the already loaded ones.

  • I am using turboSoundId = SimpleAudioEngine::sharedEngine()->playEffect(“sound.raw”, true); to loop a sample and at some point I call SimpleAudioEngine::sharedEngine()->stopEffect(turboSoundId); with the ID number I got in the previous call, but it doesn’t seems to stop the sound.

G., please let me know of any additional details needed.

Thanks again!



preloadMusic will always overwrite an already loaded track, while preloadSound shouldn’t.
Regarding the stopEffect method I couldn’t reproduce the issue you reported.

Did you try the play/stop sequence with the official CocosDenshionTest?



Thanks Giovanni,

You are right, the stop effect problem was a bug on my side.

I fixed the preloadMusic APIs to prevent overwriting (basically copying your changes to preloadSound). Attaching the modified files.