Closed yupi2 closed 8 years ago
It would also be possible to use the built-in gmod setting "mute audio if game is unfocused" (cvar for it is called snd_mute_losefocus
), although I guess it is possible that someone wants to listen to music played in gmod but mute other in-game sounds. Up to you if you want to use it really.
Also I'm not all that motivated to develop wmc-plus (eg. included medialib is outdated by a few months by now I think) so if you think it'd be easier I can give you commit rights to the repo. I don't mind reviewing the PRs though.
@wyozi I had forgotten about snd_mute_losefocus
and since it's a good idea to also mute for I made it do that.
I'll take commit rights if you're willing. I'll probably continue doing pull-requests for a bit though instead of committing directly to the repo because I'm sure I'll commit bugs to the master branch and not realize immediately.
Having it check for both cvars duplicates effort IMO; the most clear thing to do from user perspective would be to tie it directly into snd_mute_losefocus and possibly add a override to play wmcp even without focus (because I think it is more likely that someone wants to listen to wmcp music outside game without in-game sounds rather than the other way)
I replaced wmcp_muteifunfocused
with wmcp_unfocusedmute
which can now do the following when the game is unfocused:
snd_mute_losefocus
!= 0
The default value for wmcp_unfocusedmute
is 2
I'm also going to rename the pull-request.
That looks good :+1:
This won't do anything on Linux or OS X clients as
system.HasFocus()
doesn't work correctly for them.The default value is
0
so people don't have to change the ConVar to retain the current behavior of not muting.