Author Topic: feature request: alt-tab should mute sound  (Read 3374 times)

Offline eastwind

  • Newbie Mark II
  • *
  • Posts: 13
feature request: alt-tab should mute sound
« on: March 10, 2015, 02:34:55 pm »
Whenever the game window loses focus (or is iconified), whether full screen or windowed mode, the game should stop all sound. If this isn't the default behavior, there should be a checkbox option to enable this behavior in settings.

The music is really nice, but the above is pretty standard behavior for most applications, since there may be other things running that also want to play sounds when they have focus.

I didn't search your bug/feature db, so +1 if this is already on your list.

I appreciate the opportunity to give feedback that has meaningful chance of being acted upon, unlike many games developed by large teams, which, counterintuitively, tend to be less responsive.

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: feature request: alt-tab should mute sound
« Reply #1 on: March 10, 2015, 03:27:12 pm »
Cheers!  Unfortunately the Unity 3D engine doesn't actually let us detect when the game is minimized or otherwise doesn't have focus, which prevents us from doing this.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!


Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: feature request: alt-tab should mute sound
« Reply #3 on: March 11, 2015, 08:46:36 am »
Yep, I'm aware of those, and we have spoken to Unity about the bugs relating to this.

Quote
OnApplicationPause will be called any time the application is paused or unpaused. Note that it will only be paused if "run in background" is false in player settings, and that most code execution will stop until the app regains focus.

When we choose the "run in background" option, that causes a variety of problems, including loss of network connection if it's a multiplayer game.  That doesn't apply in this specific instance, but we try to keep things consistent.  We talked to Unity about this literally in 2011 or 2012 and still nothing. :(

The problem is that OnApplicationPause and OnApplicationFocus don't actually get called on games with the settings we use.  Keith had written a custom dll for AI War that detected loss of focus, but it was only for windows and it started having problems with windows after some various patches to windows itself.

This is the sort of thing that ought to be stupid easy, so it's one of the frustrating things about being in an engine that someone else writes. :/
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline eastwind

  • Newbie Mark II
  • *
  • Posts: 13
Re: feature request: alt-tab should mute sound
« Reply #4 on: March 13, 2015, 11:34:32 am »
Ah, ok, I apologize for not believing the first response. I don't have any experience with Unity, but other UI experience made me think it should be stupid easy as you say. My brief look at the Unity doc made me think that Unity is a "Tube Sock" UI/engine.


Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: feature request: alt-tab should mute sound
« Reply #5 on: March 13, 2015, 11:54:23 am »
No problem!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!