[WINESYNC][WINMM] Abort PlaySound in case of audio error

Wine commit: ca37dbcfe6309fd7caad1f53f3b76773cd0278fa

author: Jörg Höhle <hoehle@users.sourceforge.net>
Sat, 26 Mar 2011 06:36:47 +0000 (07:36 +0100)

committer: Alexandre Julliard <julliard@winehq.org>
Wed, 30 Mar 2011 11:28:04 +0000 (13:28 +0200)
This commit is contained in:
Thamatip Chitpong 2023-06-14 07:30:42 +07:00 committed by Stanislav Motylkov
parent 0cb3b85031
commit ad14255933

View file

@ -335,7 +335,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);
@ -511,17 +510,20 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
if (count < 1) break;
left -= count;
waveHdr[index].dwBufferLength = count;
waveHdr[index].dwFlags &= ~WHDR_DONE;
if (waveOutWrite(wps->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(wps->hWave);
waveOutUnprepareHeader(wps->hWave, &waveHdr[0], sizeof(WAVEHDR));