Jörg Höhle : winmm: Abort PlaySound in case of audio error.

Alexandre Julliard julliard at winehq.org
Wed Mar 30 13:15:37 CDT 2011


Module: wine
Branch: master
Commit: ca37dbcfe6309fd7caad1f53f3b76773cd0278fa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ca37dbcfe6309fd7caad1f53f3b76773cd0278fa

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Sat Mar 26 07:36:47 2011 +0100

winmm: Abort PlaySound in case of audio error.

---

 dlls/winmm/playsound.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c
index 58c833a..a6a3c87 100644
--- a/dlls/winmm/playsound.c
+++ b/dlls/winmm/playsound.c
@@ -179,7 +179,6 @@ static void CALLBACK PlaySound_Callback(HWAVEOUT hwo, UINT uMsg,
 static void PlaySound_WaitDone(struct playsound_data* s)
 {
     for (;;) {
-	ResetEvent(s->hEvent);
 	if (InterlockedDecrement(&s->dwEventCount) >= 0) break;
 	InterlockedIncrement(&s->dwEventCount);
 
@@ -437,17 +436,20 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
 	    if (count < 1) break;
 	    left -= count;
 	    waveHdr[index].dwBufferLength = count;
-	    waveHdr[index].dwFlags &= ~WHDR_DONE;
 	    if (waveOutWrite(hWave, &waveHdr[index], sizeof(WAVEHDR)) == MMSYSERR_NOERROR) {
                 index ^= 1;
                 PlaySound_WaitDone(&s);
             }
-            else FIXME("Couldn't play header\n");
+            else {
+		ERR("Aborting play loop, waveOutWrite error\n");
+		wps->bLoop = FALSE;
+		break;
+	    }
 	}
 	bRet = TRUE;
     } while (wps->bLoop);
 
-    PlaySound_WaitDone(&s); /* for last buffer */
+    PlaySound_WaitDone(&s); /* to balance first buffer */
     waveOutReset(hWave);
 
     waveOutUnprepareHeader(hWave, &waveHdr[0], sizeof(WAVEHDR));




More information about the wine-cvs mailing list