Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

Stop Wwise from queuing events when suspended?

0 votes

When our Unity-powered game loses window focus, Wwise suspends the sound engine, and no sound is heard. But when the window regains focus, we get a spamming of all of the sound events that were posted while the game was still running in the background.

  • Is there a way to tell Wwise not to suspend when focus is lost?
  • Or, a way to ignore posted events that occur when the focus is lost?
Thanks.
asked Jul 16, 2018 in General Discussion by Bob B. (130 points)

2 Answers

0 votes
Has anyone found a solution for this?
answered Apr 18, 2023 by Robert E. (550 points)
0 votes

In general, this is something to be implemented in the game's code depending on the desired outcome when the application is in the background.
The relevant general documentation can be found here: https://www.audiokinetic.com/en/library/edge/?source=SDK&id=workingwithsdks_system_calls.html#system_calls_background

In this case, if the game is allowed to keep sending events to Wwise (its game loop still runs), AK::SoundEngine::Suspend(true) is the call that should be made to allow the processing of those events, while still muting the sound.
This is activated in the Unity integration through the "RenderDuringFocusLoss" platform setting.

Instead, if on focus loss the game loop is paused, then no events can be sent to Wwise and AK::SoundEngine::Suspend(false) should be called, so that all Wwise events processing is stopped. RenderDuringFocusLoss will achieve this outcome.

For reference, the Unity integration code responsible for this handling in is located in Assets/Wwise/MonoBehavior/Runtime/AkSoundEngineController.cs.

answered Apr 18, 2023 by Samuel L. (Audiokinetic) (23,220 points)
What should I do if I want to deal with certain events specifically?
...