You might want to stop sound effects too. Also, you may want to pause them and then resume them.
It is very easy to stop or pause a sound effect. The following is the code for stopping it:
auto audio = CocosDenshion::SimpleAudioEngine::getInstance(); unsigned int _soundId; // get the sound id as playing the sound effect _soundId = audio->playEffect(EFFECT_FILE); // stop the sound effect by specifying the sound id audio->stopEffect(_soundId);
The following is the code for pausing it:
// pause the sound effect audio->pauseEffect(_soundId);
You can resume the paused code as follows:
// resume the sound effect audio->resumeEffect(_soundId);