Under windows, run the game (windowed), go into a saved game,

press Esc to get the menu, minimize using the mouse on the
window's minimize icon and then restore and you'll have sound
all the same.  HOWEVER: If you minimize by pressing the icon
on the start bar, sound will be lost upon restoring. Or, if
you use alt-tab to get away from the game window the same will
happen. Or, if you run the game fullscreen and use alt-tab to
go to the desktop (alt-tab is the only way I know) you will
lose the sound again.  Here, we are probably are hitting an
SDL_APPACTIVE or SDL_APPINPUTFOCUS event more than once and
since the block counter goes > 1 we are not restoring properly.
For now, making snd_blocked to act as a boolean and not as a
counter fixes the issue.  Hmmm...

* main_sdl.c: Revert revision 238 change, no longer necessary.
* snd_dma.c: Make snd_blocked act as a boolean and not as a
counter.


git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@241 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2010-07-25 12:20:17 +00:00
parent b4ae05875e
commit f81f9f5e05
2 changed files with 8 additions and 8 deletions

View file

@ -100,12 +100,10 @@ int main(int argc, char *argv[])
case SDL_ACTIVEEVENT:
if (event.active.state & (SDL_APPACTIVE|SDL_APPINPUTFOCUS))
{
if (!COM_CheckParm("-bgsound")) {
if (event.active.gain)
S_UnblockSound();
else
S_BlockSound();
}
if (event.active.gain)
S_UnblockSound();
else
S_BlockSound();
}
break;
case SDL_MOUSEMOTION:

View file

@ -801,8 +801,9 @@ void S_BlockSound (void)
/* FIXME: do we really need the blocking at the
* driver level?
*/
if (sound_started && ++snd_blocked == 1)
if (sound_started && snd_blocked == 0) /* ++snd_blocked == 1 */
{
snd_blocked = 1;
S_ClearBuffer ();
if (shm)
SNDDMA_BlockSound();
@ -813,8 +814,9 @@ void S_UnblockSound (void)
{
if (!sound_started || !snd_blocked)
return;
if (--snd_blocked == 0)
if (snd_blocked == 1) /* --snd_blocked == 0 */
{
snd_blocked = 0;
SNDDMA_UnblockSound();
S_ClearBuffer ();
}