winecoreaudio: Inline & eliminate the specializations of wodHelper_BeginWaveHdr.

This commit is contained in:
Ken Thomases 2006-12-21 03:48:45 -06:00 committed by Alexandre Julliard
parent be4a17876d
commit 7cecf7a40a
1 changed files with 34 additions and 59 deletions

View File

@ -882,58 +882,6 @@ static void wodHelper_CheckForLoopBegin(WINE_WAVEOUT* wwo)
} }
/**************************************************************************
* 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] * wodHelper_PlayPtrNext [internal]
* *
@ -969,15 +917,27 @@ static LPWAVEHDR wodHelper_PlayPtrNext(WINE_WAVEOUT* wwo)
wwo->lpLoopPtr = NULL; wwo->lpLoopPtr = NULL;
} }
} }
if (!didLoopBack) if (!didLoopBack)
{ {
/* We didn't loop back. Advance to the next wave header */ /* 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); pthread_mutex_unlock(&wwo->lock);
return lpWaveHdr; return lpWaveHdr;
} }
@ -1130,7 +1090,22 @@ static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
*wh = lpWaveHdr; *wh = lpWaveHdr;
if (!wwo->lpPlayPtr) 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); pthread_mutex_unlock(&wwo->lock);
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;