Commit ca37dbcf authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

winmm: Abort PlaySound in case of audio error.

parent 15ad749e
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment