在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

0 投票

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! 

分类:General Discussion | 用户: Megan S. (490 分)

1个回答

+1 投票
 
已采纳
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
用户: Dan M. (2.6k 分)
采纳于 用户:Megan S.
This was very helpful, thank you!
...