SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > Silent Hunter 4: Wolves of the Pacific
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 03-07-21, 07:35 PM   #1
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 140
Uploads: 0


Default 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!
themrwho is offline   Reply With Quote
Old 03-07-21, 10:00 PM   #2
Mad Mardigan
Admiral
 
Mad Mardigan's Avatar
 
Join Date: Sep 2016
Location: Grand Rapids, Mi.
Posts: 2,327
Downloads: 491
Uploads: 0


SHO

Quote:
Originally Posted by themrwho View Post
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!
Ahoy, themrwho...

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.

__________________
Mad Mardigan is offline   Reply With Quote
Old 03-07-21, 11:03 PM   #3
KaleunMarco
Silent Hunter
 
KaleunMarco's Avatar
 
Join Date: Sep 2007
Location: Gone to Texas. No More Kleptocratic Government for me!
Posts: 4,080
Downloads: 440
Uploads: 28


Default

Quote:
Originally Posted by themrwho View Post
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!
uh, no offense intended, but you do not want to alt-tab out of SH4. Period. End of Story.
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
KaleunMarco is offline   Reply With Quote
Old 03-08-21, 12:08 AM   #4
Mad Mardigan
Admiral
 
Mad Mardigan's Avatar
 
Join Date: Sep 2016
Location: Grand Rapids, Mi.
Posts: 2,327
Downloads: 491
Uploads: 0


SHO

Quote:
Originally Posted by KaleunMarco View Post
uh, no offense intended, but you do not want to alt-tab out of SH4. Period. End of Story.
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.

In this instance, KaleunMarco... themrwho, isn't alt tabbing out. They actually have a dual monitor set up & with that, it allows for each monitor, to do separate tasks.. in this case, SH4 & web browsing.

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.

__________________
Mad Mardigan is offline   Reply With Quote
Old 03-08-21, 01:25 AM   #5
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 140
Uploads: 0


Default

Thank you for the replies.

Quote:
Originally Posted by Mad Mardigan View Post
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...
Browsing does not require audio <-- depends on what you're browsing, doesn't it Yes, it could be text-only forums (as I mentioned earlier) but it also could be a YouTube video etc. that works better with audio.
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:
Originally Posted by KaleunMarco View Post
uh, no offense intended, but you do not want to alt-tab out of SH4. Period. End of Story.
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.
Thank you for the warning I appreciate you are trying to warn against bad stuff and I remember those issues from sh3 era.
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
themrwho is offline   Reply With Quote
Old 03-08-21, 12:56 PM   #6
Mad Mardigan
Admiral
 
Mad Mardigan's Avatar
 
Join Date: Sep 2016
Location: Grand Rapids, Mi.
Posts: 2,327
Downloads: 491
Uploads: 0


SHO

Quote:
Originally Posted by themrwho View Post
Thank you for the replies.

Quote:
Originally Posted by Mad Mardigan View Post
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...
Browsing does not require audio <-- depends on what you're browsing, doesn't it Yes, it could be text-only forums (as I mentioned earlier) but it also could be a YouTube video etc. that works better with audio.
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".
Ahoy themrwho...

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.

__________________
Mad Mardigan is offline   Reply With Quote
Old 03-08-21, 01:21 PM   #7
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 140
Uploads: 0


Default

Quote:
Originally Posted by Mad Mardigan View Post
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..
Hey thanks for getting back to me on this. That's a nice suggestion indeed. In fact I used to do that with a smallish laptop sitting on the desk. Later I moved on to tablet. It works great for consuming stuff (to watch a YouTube video, to read others AARs etc.). I think it can be better if it could all be done on one single PC though as there is limited desk space to have 2 fullsized keyboards on my desk (hence the switch from laptop to mini tablet earlier).

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
themrwho is offline   Reply With Quote
Old 03-08-21, 03:54 PM   #8
KaleunMarco
Silent Hunter
 
KaleunMarco's Avatar
 
Join Date: Sep 2007
Location: Gone to Texas. No More Kleptocratic Government for me!
Posts: 4,080
Downloads: 440
Uploads: 28


Default

Quote:
Originally Posted by themrwho View Post
I think it can be better if it could all be done on one single PC though as there is limited desk space to have 2 fullsized keyboards on my desk (hence the switch from laptop to mini tablet earlier).
look into a KVM in order to better utilize desk space.
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
KaleunMarco is offline   Reply With Quote
Old 03-08-21, 04:44 PM   #9
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 140
Uploads: 0


Default

Quote:
Originally Posted by KaleunMarco View Post
look into a KVM in order to better utilize desk space.
i have been using KVM's since we invented them back in the 90's.
hmm thanks for the suggestion. I too used to use KVM in the 90s and early 2000s prior to "Cloud" taking over everything.

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:
Flight1 SoundStream is an ingenious little tool that keeps the Flight Simulator sound enabled even when FSX is running in the background. It lets you use add-on programs developed for Flight Simulator (such as moving maps) without interrupting the in-flight sound experience. Or you can read and answer an email or surf the web during a long flight - all this without your ears leaving the cockpit. No more missed ATC calls and any warning sounds, and of course you will hear that the engines are still running!

https://www.flight1.com/products.asp...ct=soundstream
themrwho is offline   Reply With Quote
Old 03-09-21, 05:33 PM   #10
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 140
Uploads: 0


Default

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
themrwho is offline   Reply With Quote
Old 03-12-21, 12:40 PM   #11
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,911
Downloads: 444
Uploads: 2


Default



"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.
__________________

"...and bollocks to the naysayers" - Jimbuna
propbeanie is offline   Reply With Quote
Old 03-12-21, 03:08 PM   #12
Mad Mardigan
Admiral
 
Mad Mardigan's Avatar
 
Join Date: Sep 2016
Location: Grand Rapids, Mi.
Posts: 2,327
Downloads: 491
Uploads: 0


SHO

Quote:
Originally Posted by propbeanie View Post


"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.
Which is why I recommended, seeing of using another computer (be it laptop or another desktop, if you have a big enough desk to handle 2 desktops on it... ) laptop, would be a more workable, feasible solution... Barring that, a tablet would also work.. or heck, even your so called 'smart' phone.

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.

__________________
Mad Mardigan is offline   Reply With Quote
Old 03-12-21, 05:33 PM   #13
3catcircus
Grey Wolf
 
Join Date: Sep 2011
Posts: 955
Downloads: 247
Uploads: 0
Default

What is the 1-pixel-less hack?
3catcircus is offline   Reply With Quote
Old 03-12-21, 06:40 PM   #14
themrwho
Torpedoman
 
Join Date: Jul 2010
Posts: 119
Downloads: 140
Uploads: 0


Default

Quote:
Originally Posted by propbeanie View Post
"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)...<snip>
Nice video And yes, I understand this game is from a different age... With the current system resources, our computers of course can handle a SH4 and many extra tasks at the same time. While you explained the background of why it is implemented the way it is this thread is all about modifying the existing software to change its behaviour which may or may not succeed, eventually. I am happy to keep at it though, at least for now.

Quote:
Originally Posted by Mad Mardigan View Post
Which is why I recommended, seeing of using another computer (be it laptop or another desktop, if you have a big enough desk to handle 2 desktops on it...
Yup, that is the current "solution" and frankly it does work - can't argue with that.
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

Quote:
Originally Posted by 3catcircus View Post
What is the 1-pixel-less hack?
https://www.subsim.com/radioroom/sho...92&postcount=9


Edit:
Quote:
Originally Posted by propbeanie View Post
<snip>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.<snip>
You may be right in assuming that "the issues (such as CO2 bug) will eventually hit you" however I have had zero issues so far. I get that it would be pointless to say "I *feel* I will never have issues" but what I can say today is "zero obvious issues occurred so far" (that I am aware of).

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
themrwho is offline   Reply With Quote
Old 03-12-21, 08:59 PM   #15
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,911
Downloads: 444
Uploads: 2


Default

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
__________________

"...and bollocks to the naysayers" - Jimbuna
propbeanie is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.