wyozi / wmc-plus

Media center addon for Garry's Mod
MIT License
1 stars 1 forks source link

Add options for muting when the game is unfocused #10

Closed yupi2 closed 8 years ago

yupi2 commented 8 years ago

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.

wyozi commented 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.

wyozi commented 8 years ago

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.

yupi2 commented 8 years ago

@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.

wyozi commented 8 years ago

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)

yupi2 commented 8 years ago

I replaced wmcp_muteifunfocused with wmcp_unfocusedmute which can now do the following when the game is unfocused:

The default value for wmcp_unfocusedmute is 2

I'm also going to rename the pull-request.

wyozi commented 8 years ago

That looks good :+1: