- Moved SetSoundPaused() out of i_input.cpp and into s_sound.cpp.

SVN r1598 (trunk)
This commit is contained in:
Randy Heit 2009-05-23 03:09:50 +00:00
parent 86023c23ca
commit 466b6e4535
4 changed files with 54 additions and 53 deletions

View file

@ -1669,6 +1669,56 @@ void S_ResumeSound (bool notsfx)
} }
} }
//==========================================================================
//
// S_SetSoundPaused
//
// Called with state non-zero when the app is active, zero when it isn't.
//
//==========================================================================
void S_SetSoundPaused (int state)
{
if (state)
{
if (paused <= 0)
{
S_ResumeSound(true);
if (GSnd != NULL)
{
GSnd->SetInactive(false);
}
if (!netgame
#ifdef _DEBUG
&& !demoplayback
#endif
)
{
paused = 0;
}
}
}
else
{
if (paused == 0)
{
S_PauseSound(false, true);
if (GSnd != NULL)
{
GSnd->SetInactive(true);
}
if (!netgame
#ifdef _DEBUG
&& !demoplayback
#endif
)
{
paused = -1;
}
}
}
}
//========================================================================== //==========================================================================
// //
// S_EvictAllChannels // S_EvictAllChannels

View file

@ -318,6 +318,7 @@ void S_StopMusic (bool force);
// Stop and resume music, during game PAUSE. // Stop and resume music, during game PAUSE.
void S_PauseSound (bool notmusic, bool notsfx); void S_PauseSound (bool notmusic, bool notsfx);
void S_ResumeSound (bool notsfx); void S_ResumeSound (bool notsfx);
void S_SetSoundPaused (int state);
// //
// Updates music & sounds // Updates music & sounds

View file

@ -390,14 +390,8 @@ void MessagePump (const SDL_Event &sev)
if (sev.active.gain == 0) if (sev.active.gain == 0)
{ // kill focus { // kill focus
FlushDIKState (); FlushDIKState ();
if (!paused)
S_PauseSound (false);
}
else
{ // set focus
if (!paused)
S_ResumeSound ();
} }
S_SetSoundPaused(sev.active.gain);
} }
break; break;

View file

@ -371,7 +371,6 @@ static BYTE KeyState[256];
static BYTE DIKState[2][NUM_KEYS]; static BYTE DIKState[2][NUM_KEYS];
static int KeysReadCount; static int KeysReadCount;
static int ActiveDIKState; static int ActiveDIKState;
static void SetSoundPaused (int state);
// Convert DIK_* code to ASCII using Qwerty keymap // Convert DIK_* code to ASCII using Qwerty keymap
static const BYTE Convert [256] = static const BYTE Convert [256] =
@ -738,7 +737,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS); SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
} }
SetSoundPaused (wParam); S_SetSoundPaused (wParam);
break; break;
case WM_WTSSESSION_CHANGE: case WM_WTSSESSION_CHANGE:
@ -1384,50 +1383,6 @@ void I_ShutdownInput ()
} }
} }
static void SetSoundPaused (int state)
{
if (state)
{
if (paused <= 0)
{
S_ResumeSound(true);
if (GSnd != NULL)
{
GSnd->SetInactive(false);
}
if (!netgame
#ifdef _DEBUG
&& !demoplayback
#endif
)
{
paused = 0;
}
}
}
else
{
if (paused == 0)
{
S_PauseSound(false, true);
if (GSnd != NULL)
{
GSnd->SetInactive(true);
}
if (!netgame
#ifdef _DEBUG
&& !demoplayback
#endif
)
{
paused = -1;
}
}
}
}
static LONG PrevX, PrevY;
static void SetCursorState(bool visible) static void SetCursorState(bool visible)
{ {
HCURSOR usingCursor = visible ? TheArrowCursor : TheInvisibleCursor; HCURSOR usingCursor = visible ? TheArrowCursor : TheInvisibleCursor;
@ -2055,6 +2010,7 @@ protected:
void CenterMouse(int x, int y); void CenterMouse(int x, int y);
POINT UngrabbedPointerPos; POINT UngrabbedPointerPos;
LONG PrevX, PrevY;
bool Grabbed; bool Grabbed;
}; };