Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ void Win32GameEngine::reset()
//-------------------------------------------------------------------------------------------------
void Win32GameEngine::update()
{


// call the engine normal update
GameEngine::update();

Expand All @@ -112,6 +110,12 @@ void Win32GameEngine::update()
break; // keep running.
}
}

// The MilesAudioManager seems to go into a coma sometimes when the window is minimized
// and not regain focus properly when we come back. We're going to force it to wake up after we come back from being minimized.
AudioAffect aa = (AudioAffect)0x10; // AudioAffect_SystemSetting: forces m_volumeHasChanged without changing channel volumes
if (TheAudio)
TheAudio->setVolume(TheAudio->getVolume(aa), aa);
}

// allow windows to perform regular windows maintenance stuff like msgs
Expand Down
10 changes: 7 additions & 3 deletions Generals/Code/Main/WinMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message,
//restore mouse cursor to our custom version.
if (TheWin32Mouse)
TheWin32Mouse->setCursor(TheWin32Mouse->getMouseCursor());

if (TheAudio)
TheAudio->unmuteAudio(AudioManager::MuteAudioReason_WindowFocus);
}
}
return 0;
Expand All @@ -468,12 +471,13 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message,
}
else
{
if (TheAudio)
TheAudio->unmuteAudio(AudioManager::MuteAudioReason_WindowFocus);

// Cursor can only be captured after one of the activation events.
if (TheMouse)
TheMouse->refreshCursorCapture();

// Unmute audio when the window is activated.
if (TheAudio)
TheAudio->unmuteAudio(AudioManager::MuteAudioReason_WindowFocus);
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ void Win32GameEngine::update()
}
}

// When we are alt-tabbed out... the MilesAudioManager seems to go into a coma sometimes
// and not regain focus properly when we come back. This seems to wake it up nicely.
AudioAffect aa = (AudioAffect)0x10;
TheAudio->setVolume(TheAudio->getVolume( aa ), aa );
// When we are alt-tabbed out... the MilesAudioManager seems to go into a coma sometimes
// and not regain focus properly when we come back. This seems to wake it up nicely.
AudioAffect aa = (AudioAffect)0x10;
TheAudio->setVolume(TheAudio->getVolume( aa ), aa );

}

Expand Down
4 changes: 4 additions & 0 deletions GeneralsMD/Code/Main/WinMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
//restore mouse cursor to our custom version.
if (TheWin32Mouse)
TheWin32Mouse->setCursor(TheWin32Mouse->getMouseCursor());

// Unmute audio when the window is activated.
if (TheAudio)
TheAudio->unmuteAudio(AudioManager::MuteAudioReason_WindowFocus);
}
}
return 0;
Expand Down
Loading