0
0

I’m trying to use MixerStrip.setPaused() to pause the FMOD audio when the Android Application goes into background.

My FMOD related code works, but in combination with Unity’s OnApplicationPause(bool) – it seems like it doesn’t get called.

My theory is that FMOD takes too long to pause the MixerStrip, so that the Application is already paused before it happens ??

It fires ok, when the application gets resumed…

Any Infos on how to pause the FMOD sound, when the android App goes into background, would be appreciated.

Here’s my code:

[code:3mj1fn77]public class ApplicationStateManager : MonoBehaviour {

static FMOD.Studio.MixerStrip m_mixer;

void Start() {
    Application.runInBackground = false;
    GetMainMixer();
}

public void GetMainMixer() {

    var m_system = FMOD_StudioSystem.instance;
    // Get main mixer
    FMOD.GUID guid = new FMOD.GUID();
    m_system.System.lookupID("bus:/", out guid);
    m_system.System.getMixerStrip(guid, FMOD.Studio.LOADING_MODE.BEGIN_NOW, out m_mixer);
}


void OnApplicationPause (bool pauseState) {
    if (pauseState) {
        m_mixer.setPaused(true);
    }
    if (!pauseState){
        m_mixer.setPaused(false);
    }

}

}[/code:3mj1fn77]

  • You must to post comments
0
0

Hello atomtwist,

Did you manage to stop the sound when the app is paused in Android devices?

I think you are right, the OnApplicationPause handler is called but the app is paused before it can finish the operation. The function ends its execution after the app resumes, that is why a subtle pause can be heard sometimes.

I’ve also tried using the method OnApplicationFocus, with the same result.

I tried to stop the music, instead of pausing this. The music never stopped when pausing the app but was always restarted when resuming it.

I think this should be a basic feature. Many of the users don’t know how to kill the app in order to stop the persistent sound.

Anyone knows how to do this?

Thanks!

  • You must to post comments
0
0

Didn’t get it to work yet. :-(
Solution or workaround would be very appreciated !!

only happens on android btw. iOS handles these kind of things differently – and just fades out the sound if u minimize…

  • You must to post comments
0
0

Hi guys,

Sorry for the delay in replying. The next release will include the complete lowlevel API, and a new function "mixer suspend" which will not only pause the output but also put FMOD in low power mode to save battery. This has been added to the FMOD_StudioSystem.onApplicationPause so there are no code changes required on your end. This new functionality should be available later this week.

  • You must to post comments
0
0

That’s great news. :-)
Thanx a lot !!

  • You must to post comments
0
0

Thank you Peter!

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.