Crash OnApplicationPause when recording voice

Hi Connor, thanks for responding!
While we have a fix - the fix doesn’t resolve the full problem.

If we call ‘stop recording’ while not in the ‘onapplicationpause’ exit method - things are a-ok… And if we go into ApplicationPause post that point things won’t crash…

But because it’s a singing game they could be singing and then just all of a sudden stop and take off their headset - if I call RuntimeManager.CoreSystem.recordStop(0); during this ‘onapplicationpause process’ things break then and there - i think because FMOD itself actually begins to shutdown processes automatically when it’s detected than it’s going to be going into pause mode. If I don’t call recordStop things break a frame later (i think because of the callback of mCaptureDSP).

If i remove the mCaptureDSP callback the the voice playback effect (of a very low latency echo) doesn’t work very well.

The current on application pause code looks like this:


        void ProcessDeviceState()
        {
           
            if(isRecordingActive && (!isApplicationFocused || isApplicationPaused))
            {
                isRecordingActive = false;
                Debug.Log("Pausing record");

         
                _channelGroup.removeDSP(mCaptureDSP);
                mCaptureDSP.release();
                _micSound.release();
                RuntimeManager.CoreSystem.recordStop(0);
                return;

I’ve tried a bunch of variations to this exit strategy - but I am very new here - so could just be doing dumb stuff and not realise it. But none of this stops the crash.

Not sure. I’ve read somewhere else on the forum that just shutting down fmod entirely on application pause could be a valid way to go - but I haven’t actually been able to do that within this ‘onapplication pause’ without getting an error either on the way out (or application resume). Lost still.