]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_win.c
fix MMSYSERRR_STILLPLAYING handling to not increment snd_sent
[xonotic/darkplaces.git] / snd_win.c
index 80a7022951d9a98ee9e02b828ff5ce548561a1b3..91fc49135b9b68714e92828142e3615848095eef 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;