fix MMSYSERRR_STILLPLAYING handling to not increment snd_sent
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Mar 2008 20:24:58 +0000 (20:24 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 8 Mar 2008 20:24:58 +0000 (20:24 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8199 d7cf8633-e32d-0410-b094-e92efae38249

snd_win.c

index 80a7022..91fc491 100644 (file)
--- a/snd_win.c
+++ b/snd_win.c
@@ -699,27 +699,24 @@ void SndSys_Submit (void)
        {
                h = lpWaveHdr + (snd_sent & WAV_MASK);
 
-               snd_sent++;
                /*
                 * Now the data block can be sent to the output device. The
                 * waveOutWrite function returns immediately and waveform
                 * data is sent to the output device in the background.
                 */
                wResult = waveOutWrite(hWaveOut, h, sizeof(WAVEHDR));
-
-               if (wResult != MMSYSERR_NOERROR)
+               if (wResult == MMSYSERR_NOERROR)
+                       snd_sent++;
+               else if (wResult == WAVERR_STILLPLAYING)
                {
-                       if (wResult == WAVERR_STILLPLAYING)
-                       {
-                               if(developer.integer >= 1000)
-                                       Con_Print("waveOutWrite failed (too much sound data)\n");
-                       }
-                       else
-                       {
-                               Con_Printf("waveOutWrite failed, error code %d\n", (int) wResult);
-                               SndSys_Shutdown ();
-                               return;
-                       }
+                       if(developer.integer >= 1000)
+                               Con_Print("waveOutWrite failed (too much sound data)\n");
+               }
+               else
+               {
+                       Con_Printf("waveOutWrite failed, error code %d\n", (int) wResult);
+                       SndSys_Shutdown ();
+                       return;
                }
 
                paintpot -= wav_buffer_size;