https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aae34dc82735838019cdd…
commit aae34dc82735838019cdd2ab45561eac3d71ab5a
Author: Thamatip Chitpong <tangaming123456(a)outlook.com>
AuthorDate: Wed Jun 14 07:57:04 2023 +0700
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Thu Jul 6 13:36:20 2023 +0300
[WINESYNC][WINMM] Revert "winmm: Fix PlaySound so it doesn't block when
another sound is already playing."
Let the player thread call waveOutReset itself instead.
Wine commit: 15ad749eced53e0c33454970bfc2bdb58b64f92b
author: Jörg Höhle <hoehle(a)users.sourceforge.net>
Sat, 26 Mar 2011 06:44:22 +0000 (07:44 +0100)
committer: Alexandre Julliard <julliard(a)winehq.org>
Wed, 30 Mar 2011 11:28:04 +0000 (13:28 +0200)
---
dll/win32/winmm/playsound.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/dll/win32/winmm/playsound.c b/dll/win32/winmm/playsound.c
index f6b2813d34d..425b50d1603 100644
--- a/dll/win32/winmm/playsound.c
+++ b/dll/win32/winmm/playsound.c
@@ -31,7 +31,6 @@ typedef struct tagWINE_PLAYSOUND
{
unsigned bLoop : 1;
HMMIO hmmio;
- HWAVEOUT hWave;
struct tagWINE_PLAYSOUND* lpNext;
} WINE_PLAYSOUND;
@@ -427,6 +426,7 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
MMCKINFO ckMainRIFF;
MMCKINFO mmckInfo;
LPWAVEFORMATEX lpWaveFormat = NULL;
+ HWAVEOUT hWave = 0;
LPWAVEHDR waveHdr = NULL;
INT count, bufsize, left, index;
struct playsound_data s;
@@ -473,7 +473,7 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
s.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
- if (waveOutOpen(&wps->hWave, WAVE_MAPPER, lpWaveFormat,
(DWORD_PTR)PlaySound_Callback,
+ if (waveOutOpen(&hWave, WAVE_MAPPER, lpWaveFormat,
(DWORD_PTR)PlaySound_Callback,
(DWORD_PTR)&s, CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
goto errCleanUp;
@@ -487,8 +487,8 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
waveHdr[0].dwLoops = waveHdr[1].dwLoops = 0L;
waveHdr[0].dwFlags = waveHdr[1].dwFlags = 0L;
waveHdr[0].dwBufferLength = waveHdr[1].dwBufferLength = bufsize;
- if (waveOutPrepareHeader(wps->hWave, &waveHdr[0], sizeof(WAVEHDR)) ||
- waveOutPrepareHeader(wps->hWave, &waveHdr[1], sizeof(WAVEHDR))) {
+ if (waveOutPrepareHeader(hWave, &waveHdr[0], sizeof(WAVEHDR)) ||
+ waveOutPrepareHeader(hWave, &waveHdr[1], sizeof(WAVEHDR))) {
goto errCleanUp;
}
@@ -503,6 +503,7 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
{
if (WaitForSingleObject(psStopEvent, 0) == WAIT_OBJECT_0)
{
+ waveOutReset(hWave);
wps->bLoop = FALSE;
break;
}
@@ -510,7 +511,7 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
if (count < 1) break;
left -= count;
waveHdr[index].dwBufferLength = count;
- if (waveOutWrite(wps->hWave, &waveHdr[index], sizeof(WAVEHDR)) ==
MMSYSERR_NOERROR) {
+ if (waveOutWrite(hWave, &waveHdr[index], sizeof(WAVEHDR)) == MMSYSERR_NOERROR)
{
index ^= 1;
PlaySound_WaitDone(&s);
}
@@ -524,17 +525,17 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
} while (wps->bLoop);
PlaySound_WaitDone(&s); /* to balance first buffer */
- waveOutReset(wps->hWave);
+ waveOutReset(hWave);
- waveOutUnprepareHeader(wps->hWave, &waveHdr[0], sizeof(WAVEHDR));
- waveOutUnprepareHeader(wps->hWave, &waveHdr[1], sizeof(WAVEHDR));
+ waveOutUnprepareHeader(hWave, &waveHdr[0], sizeof(WAVEHDR));
+ waveOutUnprepareHeader(hWave, &waveHdr[1], sizeof(WAVEHDR));
errCleanUp:
TRACE("Done playing sound => %s!\n", bRet ? "ok" :
"ko");
CloseHandle(s.hEvent);
HeapFree(GetProcessHeap(), 0, waveHdr);
HeapFree(GetProcessHeap(), 0, lpWaveFormat);
- if (wps->hWave) while (waveOutClose(wps->hWave) == WAVERR_STILLPLAYING)
Sleep(100);
+ if (hWave) while (waveOutClose(hWave) == WAVERR_STILLPLAYING) Sleep(100);
PlaySound_Free(wps);
@@ -598,7 +599,6 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod,
DWORD fdwSo
* NULL... as of today, we stop all playing instances */
SetEvent(psStopEvent);
- waveOutReset(PlaySoundList->hWave);
LeaveCriticalSection(&WINMM_cs);
WaitForSingleObject(psLastEvent, INFINITE);
EnterCriticalSection(&WINMM_cs);