mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 21:56:06 +00:00
[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:
parent
0cb3b85031
commit
ad14255933
1 changed files with 6 additions and 4 deletions
|
@ -335,7 +335,6 @@ static void CALLBACK PlaySound_Callback(HWAVEOUT hwo, UINT uMsg,
|
||||||
static void PlaySound_WaitDone(struct playsound_data* s)
|
static void PlaySound_WaitDone(struct playsound_data* s)
|
||||||
{
|
{
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ResetEvent(s->hEvent);
|
|
||||||
if (InterlockedDecrement(&s->dwEventCount) >= 0) break;
|
if (InterlockedDecrement(&s->dwEventCount) >= 0) break;
|
||||||
InterlockedIncrement(&s->dwEventCount);
|
InterlockedIncrement(&s->dwEventCount);
|
||||||
|
|
||||||
|
@ -511,17 +510,20 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
|
||||||
if (count < 1) break;
|
if (count < 1) break;
|
||||||
left -= count;
|
left -= count;
|
||||||
waveHdr[index].dwBufferLength = count;
|
waveHdr[index].dwBufferLength = count;
|
||||||
waveHdr[index].dwFlags &= ~WHDR_DONE;
|
|
||||||
if (waveOutWrite(wps->hWave, &waveHdr[index], sizeof(WAVEHDR)) == MMSYSERR_NOERROR) {
|
if (waveOutWrite(wps->hWave, &waveHdr[index], sizeof(WAVEHDR)) == MMSYSERR_NOERROR) {
|
||||||
index ^= 1;
|
index ^= 1;
|
||||||
PlaySound_WaitDone(&s);
|
PlaySound_WaitDone(&s);
|
||||||
}
|
}
|
||||||
else FIXME("Couldn't play header\n");
|
else {
|
||||||
|
ERR("Aborting play loop, waveOutWrite error\n");
|
||||||
|
wps->bLoop = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bRet = TRUE;
|
bRet = TRUE;
|
||||||
} while (wps->bLoop);
|
} while (wps->bLoop);
|
||||||
|
|
||||||
PlaySound_WaitDone(&s); /* for last buffer */
|
PlaySound_WaitDone(&s); /* to balance first buffer */
|
||||||
waveOutReset(wps->hWave);
|
waveOutReset(wps->hWave);
|
||||||
|
|
||||||
waveOutUnprepareHeader(wps->hWave, &waveHdr[0], sizeof(WAVEHDR));
|
waveOutUnprepareHeader(wps->hWave, &waveHdr[0], sizeof(WAVEHDR));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue