[06/16] winecoreaudio: Inline & eliminate the specializations of
wodHelper_BeginWaveHdr.
Ken Thomases
ken at codeweavers.com
Thu Dec 21 03:48:45 CST 2006
They're small and only called in one place each. This prepares the ground for
future refactorings.
---
dlls/winmm/winecoreaudio/audio.c | 85 ++++++++++++++------------------------
1 files changed, 31 insertions(+), 54 deletions(-)
-------------- next part --------------
diff --git a/dlls/winmm/winecoreaudio/audio.c b/dlls/winmm/winecoreaudio/audio.c
index e24374f..ab76762 100644
--- a/dlls/winmm/winecoreaudio/audio.c
+++ b/dlls/winmm/winecoreaudio/audio.c
@@ -883,58 +883,6 @@ static void wodHelper_CheckForLoopBegin(
/**************************************************************************
-* wodHelper_BeginWaveHdrPlay [internal]
-*
-* Makes the specified lpWaveHdr the currently playing wave header.
-* If the specified wave header is a begin loop and we're not already in
-* a loop, setup the loop.
-* Call from AudioUnit IO thread can't use Wine debug channels.
-*/
-static void wodHelper_BeginWaveHdrPlay(WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
-{
- wwo->lpPlayPtr = lpWaveHdr;
-
- if (!lpWaveHdr)
- {
- OSStatus status;
- wwo->state = WINE_WS_STOPPED;
- status = AudioOutputUnitStop(wwo->audioUnit);
- if (status && wwo->err_on)
- fprintf(stderr, "err:winecoreaudio:wodHelper_BeginWaveHdrPlay AudioOutputUnitStop return %c%c%c%c\n",
- (char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
- }
- else
- wodHelper_CheckForLoopBegin(wwo);
-}
-
-
-/**************************************************************************
-* wodHelper_BeginWaveHdrWrite [internal]
-*
-* Makes the specified lpWaveHdr the currently playing wave header.
-* If the specified wave header is a begin loop and we're not already in
-* a loop, setup the loop.
-*/
-static void wodHelper_BeginWaveHdrWrite(WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
-{
- wwo->lpPlayPtr = lpWaveHdr;
-
- if (wwo->state == WINE_WS_STOPPED)
- {
- OSStatus status = AudioOutputUnitStart(wwo->audioUnit);
- if (status) {
- ERR("AudioOutputUnitStart return %c%c%c%c\n", (char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
- }
- else wwo->state = WINE_WS_PLAYING;
- }
-
- wodHelper_CheckForLoopBegin(wwo);
-
- wwo->dwPartialOffset = 0;
-}
-
-
-/**************************************************************************
* wodHelper_PlayPtrNext [internal]
*
* Advance the play pointer to the next waveheader, looping if required.
@@ -973,7 +921,21 @@ static LPWAVEHDR wodHelper_PlayPtrNext(W
if (!didLoopBack)
{
/* We didn't loop back. Advance to the next wave header */
- wodHelper_BeginWaveHdrPlay(wwo, lpWaveHdr = lpWaveHdr->lpNext);
+ lpWaveHdr = lpWaveHdr->lpNext;
+
+ wwo->lpPlayPtr = lpWaveHdr;
+
+ if (!lpWaveHdr)
+ {
+ OSStatus status;
+ wwo->state = WINE_WS_STOPPED;
+ status = AudioOutputUnitStop(wwo->audioUnit);
+ if (status && wwo->err_on)
+ fprintf(stderr, "err:winecoreaudio:wodHelper_PlayPtrNext AudioOutputUnitStop return %c%c%c%c\n",
+ (char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
+ }
+ else
+ wodHelper_CheckForLoopBegin(wwo);
}
pthread_mutex_unlock(&wwo->lock);
@@ -1130,7 +1092,22 @@ static DWORD wodWrite(WORD wDevID, LPWAV
*wh = lpWaveHdr;
if (!wwo->lpPlayPtr)
- wodHelper_BeginWaveHdrWrite(wwo,lpWaveHdr);
+ {
+ wwo->lpPlayPtr = lpWaveHdr;
+
+ if (wwo->state == WINE_WS_STOPPED)
+ {
+ OSStatus status = AudioOutputUnitStart(wwo->audioUnit);
+ if (status) {
+ ERR("AudioOutputUnitStart return %c%c%c%c\n", (char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
+ }
+ else wwo->state = WINE_WS_PLAYING;
+ }
+
+ wodHelper_CheckForLoopBegin(wwo);
+
+ wwo->dwPartialOffset = 0;
+ }
pthread_mutex_unlock(&wwo->lock);
return MMSYSERR_NOERROR;
More information about the wine-patches
mailing list