Commit 8116d4e1 authored by Hiroki Awata's avatar Hiroki Awata Committed by Alexandre Julliard

dsound: Notify DSBPN_OFFSETSTOP earlier.

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=41292Signed-off-by: 's avatarHiroki Awata <castaneai@by.black> Signed-off-by: 's avatarAndrew Eikum <aeikum@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 050378d4
...@@ -296,8 +296,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Play(IDirectSoundBuffer8 *iface, DW ...@@ -296,8 +296,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Play(IDirectSoundBuffer8 *iface, DW
if (This->state == STATE_STOPPED) { if (This->state == STATE_STOPPED) {
This->leadin = TRUE; This->leadin = TRUE;
This->state = STATE_STARTING; This->state = STATE_STARTING;
} else if (This->state == STATE_STOPPING) }
This->state = STATE_PLAYING;
for (i = 0; i < This->num_filters; i++) { for (i = 0; i < This->num_filters; i++) {
IMediaObject_Discontinuity(This->filters[i].obj, 0); IMediaObject_Discontinuity(This->filters[i].obj, 0);
...@@ -317,9 +316,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Stop(IDirectSoundBuffer8 *iface) ...@@ -317,9 +316,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Stop(IDirectSoundBuffer8 *iface)
AcquireSRWLockExclusive(&This->lock); AcquireSRWLockExclusive(&This->lock);
if (This->state == STATE_PLAYING) if (This->state == STATE_PLAYING || This->state == STATE_STARTING)
This->state = STATE_STOPPING;
else if (This->state == STATE_STARTING)
{ {
This->state = STATE_STOPPED; This->state = STATE_STOPPED;
DSOUND_CheckEvent(This, 0, 0); DSOUND_CheckEvent(This, 0, 0);
......
...@@ -593,11 +593,7 @@ static void DSOUND_MixToPrimary(const DirectSoundDevice *device, float *mix_buff ...@@ -593,11 +593,7 @@ static void DSOUND_MixToPrimary(const DirectSoundDevice *device, float *mix_buff
if (dsb->buflen && dsb->state) { if (dsb->buflen && dsb->state) {
TRACE("Checking %p, frames=%d\n", dsb, frames); TRACE("Checking %p, frames=%d\n", dsb, frames);
AcquireSRWLockShared(&dsb->lock); AcquireSRWLockShared(&dsb->lock);
/* if buffer is stopping it is stopped now */ if (dsb->state != STATE_STOPPED) {
if (dsb->state == STATE_STOPPING) {
dsb->state = STATE_STOPPED;
DSOUND_CheckEvent(dsb, 0, 0);
} else if (dsb->state != STATE_STOPPED) {
/* if the buffer was starting, it must be playing now */ /* if the buffer was starting, it must be playing now */
if (dsb->state == STATE_STARTING) if (dsb->state == STATE_STARTING)
......
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