SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
03-07-21, 07:35 PM | #1 |
Torpedoman
|
Does anyone know a way to retain audio when sh4 window loses focus?
Hi,
My question is for Silent Hunter v.1.5 running on Windows 10. For this game, does anyone know a way to retain audio when sh4 window loses focus? Extra info: As you might know, this is a design decision by developers - whether an application continues to emit audio when application window does not have focus. Usually this is a trivial thing to enable/disable for the dev team (or anyone with source code access). In fact some games even expose this, as a game-options-UI-setting (or sometimes as a not-so-apparent configuration tweak such as an .ini file or a startup parameter to the application launcher etc.). If there is a way for sh4 so far I have not found it hence the query. Search results: I searched this forum and the web for before I post this thread. The only Subsim forums thread I managed to find on this matter was the one for sh5. Of course it does not help me with sh4 (and didn't help that guy with sh5). SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > Silent Hunter 5 How to still hear game sound when game window is not focused on (alt-tabbed)? https://www.subsim.com/radioroom/sho...d.php?t=174765 Background story: I have a dual-screen setup, I run sh4 in fullscreen borderless state (using the 1-pixel-less hack) on screen1 and I'm browsing the forums/web etc. on screen2. During long patrols with reduced time compression, most of the time nothing exciting is happening in the game so I listen to the radio/gramophone and browse forums etc. With this setup I can visually see what's happening in the game but I'm missing out on radio/gramophone at all times and also because there is no crew audio announcements ("ship spotted!" etc.) that I can hear, I can miss a critical situation if I don't visually check out the screen for a while so if I can fix this missing audio issue I think my setup would be perfect! Thanks in advance for any replies! |
03-07-21, 10:00 PM | #2 | |
Admiral
|
Quote:
Dunno, but.. if it can be done, set the focus sound wise to SH4... browsing posts & such.. doesn't really call for audio.. but.. that's just My suggestion... M. M.
__________________
|
|
03-07-21, 11:03 PM | #3 | |
Silent Hunter
|
Quote:
All sorts of bad things happen when a Kaleun shells out to Windows to go and do something non-SH4. Do a search in Subsim or even Google for CTD and other assorted bad things and you will learn that the number one cause is shelling out/alt-tabbing. good luck.
__________________
there are only two things in the world: submarines and targets. Fortis et stabilis et fidelis, semper ------------------------------------------------------------ Silent Hunter 4 1.5 Gold Edition on CDROM LAA enabled Dell XPS with 32 GB Ram running Win10 |
|
03-08-21, 12:08 AM | #4 | |
Admiral
|
Quote:
What they re trying to figure out, is with using their set up, in that manner.. is how to have audio on the monitor, running SH4.. as I understand it. On that, am not sure of what would need being done to accomplish that... M. M.
__________________
|
|
03-08-21, 01:25 AM | #5 | ||
Torpedoman
|
Thank you for the replies.
Quote:
In any case "does the other screen really require audio" is perhaps a nice discussion point but not my current focus or current problem. The problem is: the moment focus is on another "window" (the other window could be a web browser with a forums page or a video in it, it could even be a simple notepad), that very moment audio from sh4 window is completely muted out. In other words, sh4 window emits audio only when it has "focus". It's audio capability is linked to whether it is "the active window". Quote:
Having said that, it's all in the past for me - I currently have a very stable setup with zero CTD or other issues (that I am aware of) so far. While I acknowledge bad stuff can happen (such as CO2 issue etc.) since it has not happened to me yet, no need to curtail freedoms that help me enjoy long patrol periods. This is not twice as good as sh3, in my scale my current sh4 experience is 10x better than sh3 experience so I will continue on this road (of running sh4 in my one screen, doing other stuff on my other screen). It works great. Strongly recommended - just try it out. If you have "bad stuff" happening to you obviously stop doing that but so far my "bad stuff experienced" counter is at zero after playing hundreds of hours on this PC |
||
03-08-21, 12:56 PM | #6 | ||
Admiral
|
Quote:
Ok Just spit balling this here... Could also do what I am considering doing... Have another tower I am working on & having that 1 to be My more... hard core gaming go to rig. Had thought of then selling this 1 I am on now, off as someone else's starter.. but, on reflection... could still keep it around to use as 1 to use for like web browsing, email checking social media type stuff... so that definitely frees up the other rig, for as I outlined.. My go to game rig only. Not saying you have to go that route as well.. but.. is something to consider.. just a suggestion. On that note... best to you on this.. & Good huntin'... M. M.
__________________
|
||
03-08-21, 01:21 PM | #7 | |
Torpedoman
|
Quote:
I am still hoping -at this point, more like dreaming about- a fix to this problem though so that these long sh4 cruises can be a background task WITH audio.... Web search shows many people had similar requirements/wishes, even for other games, here is one for Mass Effect from 8 years ago: https://gaming.stackexchange.com/q/129032 Too bad Ubisoft devs didn't make this a simple checkbox (or even a .ini setting etc.). EDIT: found an example of what I was trying to explain earlier, as can be seen in this "answer", in another game engine for example, it is literally a "setting". In this case, it is, how many percent of audio volume do you wish to LOSE when game window loses focus --> https://answers.unrealengine.com/que...ing-focus.html If it was a setting like that, in Silent Hunter 4, we could set it to zero and be done with it Last edited by themrwho; 03-08-21 at 01:24 PM. Reason: add unity engine example |
|
03-08-21, 03:54 PM | #8 | |
Silent Hunter
|
Quote:
i have been using KVM's since we invented them back in the 90's.
__________________
there are only two things in the world: submarines and targets. Fortis et stabilis et fidelis, semper ------------------------------------------------------------ Silent Hunter 4 1.5 Gold Edition on CDROM LAA enabled Dell XPS with 32 GB Ram running Win10 |
|
03-08-21, 04:44 PM | #9 | ||
Torpedoman
|
Quote:
Today though, at my home, rather than adding a KVM (plus cables) to the mix, I could just keep using the laptop as a self contained 2nd set of computer (or tablet with its virtual keyboard - it's less comfy to type but also less desktop clutter). Periscope depth in my heart though, I'm still hoping/dreaming a software solution to my problem that would help me get rid of 2nd laptop/tablet/PC altogether so that I can end up with just 1 computer with 2 screens; SH4 running on one with audio-in-the-background feature patrolling at low TC, and "other stuff" running on the other (focus active) screen. To give any interested parties an update: I web searched some more today and found this "product" that someone was selling to people like me. It solves the same problem I have here but it is not for Silent Hunter but for Microsoft's Flight Simulator game: Quote:
|
||
03-09-21, 05:33 PM | #10 |
Torpedoman
|
I did some further research into this yesterday, I would like to share results below in case someone out there who has experience with Windows API/MFC/whatever-else-is-in-play-here wants to lend experience.
Found a potential hack as described in the 1st link below - it is essentially sending WM_ACTIVATE message to the window as per official Microsoft documentation in the 2nd URL. I have so far no evidence that this is implemented in the gamecode so I was not super hopeful but was thinking it's probably worth a try, what would I lose. I still didn't get a chance to implement it in C++ but did look into quickly testing it with a 2 line AHK script as I noticed it is in the AutoHotkey message list (3rd URL). Test result: basic messaging via AHK does work, at least it works for some messages (e.g.: WM_CLOSE/0x0010 indeed closes SH4 application just fine). Unfortunately sending WM_ACTIVATE via AHK did nothing. At then end of the day, while I am not anywhere close to fixing the original problem described in the title of this thread, one good (practical) thing came out of all this effort... I discovered that I can message the game window with hide/unhide signals (easiest way would be using AHK and WinHide/WinShow signals). The practical implementation would be: "boss key" or in my case, more like "boss shortcut". During the day sometimes I fire up and play sh4 for short amount of time but the darn window is always on top thus it takes away 50% of my screen estate on a dual screen setup, forcing me to close the game as soon as I need to do something else on that screen. With this boss-shortcut hack, I can now press a key-combo to hide it completely. And, later on, press the same key-combo bring it back maybe 10 minutes later or maybe 5 hours later, after work hours. Less loading time, more playing time! Links 1) https://stackoverflow.com/a/45496600 2) https://docs.microsoft.com/en-us/win...ev/wm-activate 3) https://www.autohotkey.com/docs/misc...essageList.htm |
03-12-21, 12:40 PM | #11 |
CTD - it's not just a job
|
"It's not nice to fool with Microsoft!!!" The issue has more to do with the game's programming paradigm. When it was written (Windows XP, and 32-bit), there were only "dreams" of multi-tasking, and "fake" alternatives to it, of which, most of the current technologies really are nothing more than more "efficient" ways to simulate multi-tasking, based mostly on the hardware resources available in the 'modern' computer... but I digress. SH4 is a single-core game, that assumes its address space is the same, no matter what you do in windows. It is for this reason that "swapping out" to the OS "kills" the audio stream, sometimes resulting in an address change of the buffer for the game (from Windows, which leads, guides and directs all aspects of one's computer life), which sometimes results in "odd" behavior when the game once again gains focus. Your current technique apparently minimizes these "issues", but it still might just be a roll of the dice before you get the CO2 not clearing, or the cloud of steam following your boat about the seas of the world, or anyone of a varied sort of maladies yet to be encountered. To keep the audio stream "alive", the game needs to keep "focus", which of course negates the computer's use for anything other than SH4 exclusively. |
03-12-21, 03:08 PM | #12 | |
Admiral
|
Quote:
Of course, that is up to the 1 trying to do what is being discussed about doing by the main poster... not throwing rocks at their aspirations, just saying what I see of as more.. advisable options. From My perspective... M. M.
__________________
|
|
03-12-21, 05:33 PM | #13 |
Grey Wolf
Join Date: Sep 2011
Posts: 955
Downloads: 247
Uploads: 0
|
What is the 1-pixel-less hack?
|
03-12-21, 06:40 PM | #14 | |||
Torpedoman
|
Quote:
Quote:
If a software workaround can be found, I will be happy to reduce the total computer count by one - if one cannot be found, I will continue as is. I have invested some time on this issue, and there is at least one more method I would like to try. I will share the results here in case it benefits anyone else. Meanwhile, this thread stays open, waiting for that miracle in case someone knows a way to implement this somehow https://www.subsim.com/radioroom/sho...92&postcount=9 Edit: Quote:
Which makes me think: am I not having the issues due to the fullscreen borderless window approach I have taken? Are you using fullscreen or are you using 1-pixel-less (as described in the linked post above)? If you have not tried the 1-pixel-less method yet, perhaps give it a try as I have been saying it seems to be perfect. Last edited by themrwho; 03-12-21 at 06:58 PM. Reason: add response to propbeanie about real fullscreen vs borderless fullscreen-ish |
|||
03-12-21, 08:59 PM | #15 |
CTD - it's not just a job
|
I have implemented the windowed mode on my desktop downstairs, dual-screen, and I also have not had issue (yet). Curiosity has gotten the better of me on more than one occasion, but not here yet. I'll let you know if I do have issues. Of course, as you say, the 'modern' pc is quite the Hercules when compared to what we had in 2007 and around that era. If I remember correctly, PCIe was in its infancy? So most computers were AGP, and a ATI 9800 was top notch stuff... lol
|
Thread Tools | |
Display Modes | |
|
|