SimpleAudioEngine fails to play SFX after soft reset but not every time

51 Views Asked by At

When handling soft resets in iOS anyone have any idea why resumeAllEffects() may not work? Have tried calling within Appdelegate and in our Main.js (we're doing a load under JS)...

Only thing that seems to fix it is restarting the engine under AudioEngine.end

void AppDelegate::applicationWillEnterForeground(){

if (applicationHasBeenToBackground)
{
    applicationHasBeenToBackground = false;

    CCDirector::sharedDirector()->startAnimation();

    CCDirector::sharedDirector()->getScheduler()->scheduleSelector(schedule_selector(AppDelegate::delayedOnWillEnterForeground), this, 0.0f, 0, 0.0f, false);
    CocosDenshion::SimpleAudioEngine::sharedEngine()->resumeAllEffects();
    CocosDenshion::SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
            cout << "\n\n\n RESUME \n\n\n";


}}

The more detailed part is - if the resumeBackgroundMusic part is included and I single tap home, then the effects stop. If I remove the resumeBackgroundMusic the effects behave correctly, as does the music.... but then the music will not mute on double tap....

When doing the same from another part of the game - (a whole front end menu area) - then the opposite happens.

any ideas?

0

There are 0 best solutions below