[PATCH v2] dsound: Notify DSBPN_OFFSETSTOP earlier.

Hiroki Awata castaneai at by.black
Thu Jun 3 01:12:23 CDT 2021


Some games may not receive the DSBPN_OFFSETSTOP event and get stuck if CloseHandle is called immediately after IDirectSoundBuffer::Stop.
To solve this problem, IDirectSoundBuffer::Stop will immediately notify the DSBPN_OFFSETSTOP event.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41292
Signed-off-by: Hiroki Awata <castaneai at by.black>
---
 dlls/dsound/buffer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index fafa6fc6015..8cbcd8f9fc5 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -317,9 +317,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Stop(IDirectSoundBuffer8 *iface)
 
 	AcquireSRWLockExclusive(&This->lock);
 
-	if (This->state == STATE_PLAYING)
-		This->state = STATE_STOPPING;
-	else if (This->state == STATE_STARTING)
+	if (This->state == STATE_PLAYING || This->state == STATE_STARTING)
 	{
 		This->state = STATE_STOPPED;
 		DSOUND_CheckEvent(This, 0, 0);
-- 
2.27.0




More information about the wine-devel mailing list