Instant freeze when playing sound effect

Instant freeze when playing sound effect
0.0 0

#1

Hi all.

I use this code when my ball crashes with an obstacle:

auto audio = CocosDenshion::SimpleAudioEngine::getInstance();
audio->stopBackgroundMusic();
audio->playEffect("sounds/crash.ogg");

But my game freezes for a bit (like a second or less). If I remove the code above, it doesn’t freeze, it runs smoothly.

What can I do to make the game run smoothly along with sound effects? Thanks!


#2

Is there this freeze every time or only the first time?