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.

+1 vote
I have a character that has ambient sounds come from them. Unfortunately these, and all other sounds, stop when leaving a level streaming volume in UE4. The stop all event is called.  Where can we intercept this and make it so that the stop all function is not called? Or a way that we can change it, that if a level is unloaded/destroyed in this fashion?

 

-Rob
in General Discussion by Robert M. (4.6k points)
edited by Robert M.

2 Answers

+3 votes
Hi Rob, i'm having a similar issue. What i found out is that AkAudioDevice registers to the LevelRemovedFromWorld callback. If this callback is called, AkAudioDevice will call its flush method and, like you said, will call StopAll from wwise api.

In our case, we are streaming levels when moving forward in the map. When the streaming happens, the callback gets called.

I didn't find any solution for our specific case. I might try filtering the Flush method if some specific levels are removed but not all.

I would be curious to know if you found any solution to your problem.

Cheers,
by Francois P. (200 points)
We ran into a similar problem and had to comment out the implementation of FAkAudioDevice::OnLevelRemoved to avoid the unwanted StopAll calls interfering with, say, looping ambient sounds as various unrelated sub-levels were loaded and unloaded into the main level.  Rather, we called Flush directly from higher-level logic in our game module explicitly associated with the main level unload.  Game-specific to be sure, but equivalent to Fracois’ suggestion of adjusting OnLevelRemoved’s behaviour dependent on Inlevel.
+1 vote
void FAkAudioDevice::OnLevelRemoved(ULevel* InLevel, UWorld* InWorld)
{
    if (InLevel && InLevel->IsPersistentLevel())
    {
        Flush(NULL);
    }
}

 

 

Hey guys ^ that is the code my programmer was able to implement in akaudiodevice.cpp. He just recently learned about level unloading and loading so was finally able to help me out on this one. But this code basically checks if the level is the main persistent level. If so then unload, if not then don't unload. This has one draw back though, certain sounds say like ambient sounds in a room that should not continue on in another room do not turn off. So you will just have to create a custom BP to take care of that for you so you don't overload the system.

 

-Rob
by Robert M. (4.6k points)
Thanks for following up Robert. This should do the trick. On our side, we simply removed the flush since they were no drawback of doing so in the context of our game.
Thanks for the follow up Robert as I just discovered this today.

Sadly I haven't got time to dig more into this to see how it's should be properly be used.
Hi there, we are in 2022, am I wrong saying this issue is still true ? I have the exact same issue and can't figure out other solution than maybe adding this piece of code...
In our system, we could see that this bug was fixed in 2016.1.2 as "WG-30304 Fixed: "Unload stream level" no longer posts a global "Stop All" to the SoundEngine."
https://www.audiokinetic.com/library/2019.2.14_7616/?source=UE4&id=releasenotes_2016_1_2.html
If you are encountering this issue, you might be facing a different issue or this issue came back as a side-effect of other changes. You can report the issue through a Bug Report (https://www.audiokinetic.com/library/edge/?source=InstallGuide&id=reporting_bugs) where you can share how you reproduce the issue and which versions of the product you are using.
...