Apologies for the delayed response - after testing on multiple devices and simulators, I unfortunately haven’t been able to reproduce the issue in your video. That said, as previously mentioned I wouldn’t be concerned about your workaround of manually setting the output, but please let us know if you run into any issues with it.
The closest thing I’m able to reproduce is a similar small sound to the one in the video, but instead of occurring a small while after suspending, it occurs on resuming, just before the audio volume begins to ramp back in. Is this behavior something that you’ve experienced on your end?
Just following up on this - was the behavior that I described with a small sound on resume before volume ramps back in something that you’ve experienced on your end?
No, our problem is a sound during the termination of application as shown on the video that I’ve uploaded recently.
Thank you for providing the apk, I can reproduce the issue with sound returning after closing the application.
I can see in the log that on terminating the application there is a call to System::mixerSuspend
, but shortly after there is also call to System::mixerResume
, which is why you are getting a short burst of sound. My guess would be that you have a lifecycle callback with mixerResume
in it, and it is being triggered after the application has begun shutting down. I am seeing a log for [Engine] Application shutdown!
right before the mixerResume
call- perhaps you could try setting a flag immediately after your engine shuts down that prevents the mixer from being resumed? Without knowing what the code looks like, perhaps something similar to:
void Shutdown()
{
Log.i("[Engine] Application shutdown!");
gShuttingDown = true;
}
...
void onResume()
{
if (!gShuttingDown)
{
system->mixerResume();
}
}
I’ve figured out the reason why we have it. You have the phrase in the documentation:
It is extremely important to ensure no FMOD APIs are called in-between suspend and resume as they run the risk of causing a deadlock
But we need some FMOD calls to finish it’s work correctly like unloading banks, releasing system components. Can we do it safely without resuming a mixer?
Unloading banks and/or releasing without resuming the mixer is extremely unlikely to be safe, especially since unloading banks will unload event/mixer metadata and underlying sample data.
If you need to “stop” the mixer from outputting all sound before unloading banks or releasing the system, you could access the Master Bus and use something like Studio::Bus::stopAllEvents
or Studio::Bus::setPaused
.
Apart from that, what specifically are you trying to do that requires FMOD calls while the mixer is suspended?
I’ve managed to reproduce the problem with your sample fmodstudioapi20223android\api\studio\examples\androidstudio\cmake\simple_event
. I’ve attached simple_event.cpp file with changed extension to txt. You can download it and try.
simple_event.txt (5.8 KB)
You need to run app, than press B to start the ambience sound, than press D to suspend the mixer/set paused master bus/stop sound, than press Back to quit the app. During the exit process a little sound appears when mixerResume command runs but it shouldn’t because it’s already stopped and the bus is paused.
If you remove mixerSuspend/mixerResume commands everything works fine.
Much obliged, I’ll take a look at it shortly!
Thanks again for the modified example script. I’ve given it a test on my end and I am indeed able to consistently reproduce the issue with it. I don’t have any workarounds to offer at the moment, but I’ve passed it to the development team for further investigation, and if there’s any updates regarding the issue I’ll let you know.
Hello, I’ve checked the latest version(2.02.24) and it still has the same problem. Do you have any plans to fix it?
Hi,
The fix for this issue has been assigned for our next release.