[04/16] winecoreaudio: Simplify handling of BEGIN+ENDLOOP wave
headers.
Ken Thomases
ken at codeweavers.com
Thu Dec 21 03:48:23 CST 2006
The question is what to do if the application writes a BEGINLOOP header and
then, some time later, writes a BEGIN+ENDLOOP header. The current code treats
the latter as both ending the long loop and establishing a new one-header
loop. This patch changes it to ignore the BEGINLOOP flag on the new header,
so the BEGIN+ENDLOOP header merely ends the long loop.
Note that this is analogous to the behavior for a BEGINLOOP... BEGINLOOP...
ENDLOOP sequence. In wodHelper_CheckForLoopBegin(), the interior BEGINLOOP
is explicitly ignored. So, this patch treats the BEGINLOOP flag on the new
header as any other BEGINLOOP header encountered while a loop is already in
progress.
This patch prepares the ground for future refactoring.
---
dlls/winmm/winecoreaudio/audio.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
-------------- next part --------------
diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c
index d28759b..9e26c31 100644
--- a/dlls/winmm/winecoreaudio/audio.c
+++ b/dlls/winmm/winecoreaudio/audio.c
@@ -935,6 +935,7 @@ static void wodHelper_BeginWaveHdr(WINE_
static LPWAVEHDR wodHelper_PlayPtrNext(WINE_WAVEOUT* wwo)
{
LPWAVEHDR lpWaveHdr;
+ BOOL didLoopBack = FALSE;
pthread_mutex_lock(&wwo->lock);
@@ -953,24 +954,17 @@ static LPWAVEHDR wodHelper_PlayPtrNext(W
{
wwo->dwLoops--;
wwo->lpPlayPtr = wwo->lpLoopPtr;
- } else
+ didLoopBack = TRUE;
+ }
+ else
{
- /* Handle overlapping loops correctly */
- if (wwo->lpLoopPtr != lpWaveHdr && (lpWaveHdr->dwFlags & WHDR_BEGINLOOP)) {
- /* shall we consider the END flag for the closing loop or for
- * the opening one or for both ???
- * code assumes for closing loop only
- */
- } else
- {
- lpWaveHdr = lpWaveHdr->lpNext;
- }
wwo->lpLoopPtr = NULL;
- wodHelper_BeginWaveHdr(wwo, lpWaveHdr);
}
- } else
+ }
+
+ if (!didLoopBack)
{
- /* We're not in a loop. Advance to the next wave header */
+ /* We didn't loop back. Advance to the next wave header */
wodHelper_BeginWaveHdr(wwo, lpWaveHdr = lpWaveHdr->lpNext);
}
More information about the wine-patches
mailing list