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.

0 votes

I have just started a new game project with Wwise and was wondering what the best practice is for dealing with suppressing audio when the game window is in the background.

This game is on Windows and I found this documentation describing how to handle the issue on Windows. I'm not too certain how to provide the hWnd of my game window properly, though. Or if I should be using Suspend() to deal with this somewhere instead. I've tried a few solutions, but none of them seem to work. Any suggestions on how to handle this?

Thanks! 

in General Discussion by Megan S. (470 points)

1 Answer

+1 vote
 
Best answer
firstly setup an rtpc and you will use to change the sounds you want to change when the window doesn't have focus - e.g 100 window in focus 0 window not in focus ( 99-1 fades between the two ) - this might be as simple as controlling the master bus volume.

secondly realize that now just need to set this rtpc ( with a fade ) to either 100 or 0 depending on if the window has focus.

lastly you need to find the point in your engine where you can detect when this changes most have this for some other reason so dig around - you might need to add this, in which case it will depend upon the platform for windows start by looking at WM_SIZE https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-size - hopefully its clear that this part is nothing really to do with wwise but more of a general engine thing to call code that wants to run when the window comes and goes.

hope that helps

-

dan.murray
by Dan M. (2.6k points)
selected by Megan S.
This was very helpful, thank you!
...