Skip to content

Commit

Permalink
- separate i_pauseinbackground and i_soundinbackground - they pro…
Browse files Browse the repository at this point in the history
…bably should ultimately be moved out of the sound code
  • Loading branch information
madame-rachelle committed Jan 16, 2022
1 parent c3fc4e3 commit 12ed24d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/common/platform/posix/cocoa/i_main.mm
Expand Up @@ -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 )
Expand Down Expand Up @@ -293,7 +292,7 @@ - (void)applicationWillResignActive:(NSNotification*)aNotification
{
ZD_UNUSED(aNotification);

S_SetSoundPaused(i_soundinbackground);
S_SetSoundPaused(0);

AppActive = false;
}
Expand Down
4 changes: 1 addition & 3 deletions src/common/platform/posix/sdl/sdlglvideo.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions src/common/platform/win32/i_input.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down
21 changes: 12 additions & 9 deletions src/sound/s_doomsound.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand All @@ -954,14 +965,6 @@ void S_SetSoundPaused(int state)
}
}
}
if (!netgame
#ifdef _DEBUG
&& !demoplayback
#endif
)
{
pauseext = !state;
}
}


Expand Down

0 comments on commit 12ed24d

Please sign in to comment.