From 12ed24d066a819a128a54e2359fd0e2d48f641fe Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 15 Jan 2022 20:17:11 -0500 Subject: [PATCH] - separate `i_pauseinbackground` and `i_soundinbackground` - they probably should ultimately be moved out of the sound code --- src/common/platform/posix/cocoa/i_main.mm | 3 +-- src/common/platform/posix/sdl/sdlglvideo.cpp | 4 +--- src/common/platform/win32/i_input.cpp | 3 +-- src/sound/s_doomsound.cpp | 21 +++++++++++--------- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/common/platform/posix/cocoa/i_main.mm b/src/common/platform/posix/cocoa/i_main.mm index 09c1daf56e3..382fabb23bd 100644 --- a/src/common/platform/posix/cocoa/i_main.mm +++ b/src/common/platform/posix/cocoa/i_main.mm @@ -55,7 +55,6 @@ // --------------------------------------------------------------------------- -CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) EXTERN_CVAR(Int, vid_defwidth ) EXTERN_CVAR(Int, vid_defheight) EXTERN_CVAR(Bool, vid_vsync ) @@ -293,7 +292,7 @@ - (void)applicationWillResignActive:(NSNotification*)aNotification { ZD_UNUSED(aNotification); - S_SetSoundPaused(i_soundinbackground); + S_SetSoundPaused(0); AppActive = false; } diff --git a/src/common/platform/posix/sdl/sdlglvideo.cpp b/src/common/platform/posix/sdl/sdlglvideo.cpp index 9b4aa6cd6c0..a5f7e6b527e 100644 --- a/src/common/platform/posix/sdl/sdlglvideo.cpp +++ b/src/common/platform/posix/sdl/sdlglvideo.cpp @@ -95,8 +95,6 @@ CUSTOM_CVAR(Bool, gl_es, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCA Printf("This won't take effect until " GAMENAME " is restarted.\n"); } -CVAR(Bool, i_soundinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) - CVAR (Int, vid_adapter, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(String, vid_sdl_render_driver, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) @@ -721,7 +719,7 @@ void ProcessSDLWindowEvent(const SDL_WindowEvent &event) break; case SDL_WINDOWEVENT_FOCUS_LOST: - S_SetSoundPaused(i_soundinbackground); + S_SetSoundPaused(0); AppActive = false; break; diff --git a/src/common/platform/win32/i_input.cpp b/src/common/platform/win32/i_input.cpp index c62bbcf42b8..06b1e98017f 100644 --- a/src/common/platform/win32/i_input.cpp +++ b/src/common/platform/win32/i_input.cpp @@ -140,7 +140,6 @@ int BlockMouseMove; static bool EventHandlerResultForNativeMouse; -CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) extern int chatmodeon; @@ -508,7 +507,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS); } - S_SetSoundPaused ((!!i_soundinbackground) || wParam); + S_SetSoundPaused (wParam); break; case WM_WTSSESSION_CHANGE: diff --git a/src/sound/s_doomsound.cpp b/src/sound/s_doomsound.cpp index 6b954906798..d70318e602e 100644 --- a/src/sound/s_doomsound.cpp +++ b/src/sound/s_doomsound.cpp @@ -71,6 +71,8 @@ FBoolCVar noisedebug("noise", false, 0); // [RH] Print sound debugging info? +CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CVAR (Bool, i_pauseinbackground, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) static FString LastLocalSndInfo; @@ -930,7 +932,16 @@ void S_SerializeSounds(FSerializer &arc) void S_SetSoundPaused(int state) { - if (state) + if (!netgame && (i_pauseinbackground) +#ifdef _DEBUG + && !demoplayback +#endif + ) + { + pauseext = !state; + } + + if ((state || i_soundinbackground) && !pauseext) { if (paused == 0) { @@ -954,14 +965,6 @@ void S_SetSoundPaused(int state) } } } - if (!netgame -#ifdef _DEBUG - && !demoplayback -#endif - ) - { - pauseext = !state; - } }