Module: wine Branch: master Commit: ed10114b12b23b809c4e08c77fb2b1386eed391b URL: http://source.winehq.org/git/wine.git/?a=commit;h=ed10114b12b23b809c4e08c77f... Author: Ken Thomases <ken(a)codeweavers.com> Date: Wed Jun 20 07:01:07 2007 -0500 winecoreaudio: Move notify of completed WAVEHDRs to end of wodReset. --- dlls/winecoreaudio.drv/audio.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/winecoreaudio.drv/audio.c b/dlls/winecoreaudio.drv/audio.c index e5b3e7d..5a3e82b 100644 --- a/dlls/winecoreaudio.drv/audio.c +++ b/dlls/winecoreaudio.drv/audio.c @@ -1265,6 +1265,7 @@ static DWORD wodReset(WORD wDevID) { WINE_WAVEOUT* wwo; OSStatus status; + LPWAVEHDR lpSavedQueuePtr; TRACE("(%u);\n", wDevID); @@ -1276,12 +1277,9 @@ static DWORD wodReset(WORD wDevID) wwo = &WOutDev[wDevID]; - /* updates current notify list */ - /* if resetting, remove all wave headers and notify client that all headers were completed */ - wodHelper_NotifyCompletions(wwo, TRUE); - OSSpinLockLock(&wwo->lock); + lpSavedQueuePtr = wwo->lpQueuePtr; wwo->lpPlayPtr = wwo->lpQueuePtr = wwo->lpLoopPtr = NULL; wwo->state = WINE_WS_STOPPED; wwo->dwPlayedTotal = wwo->dwWrittenTotal = 0; @@ -1298,6 +1296,11 @@ static DWORD wodReset(WORD wDevID) return MMSYSERR_ERROR; /* FIXME return an error based on the OSStatus */ } + /* Now, send the "done" notification for each header in our list. */ + /* Do this last so the reset operation is effectively complete before the + * app does whatever it's going to do in response to these notifications. */ + wodHelper_NotifyDoneForList(wwo, lpSavedQueuePtr); + return MMSYSERR_NOERROR; }