winecoreaudio: Control the fprintf's by the Wine debug channel on/off settings.

This commit is contained in:
Ken Thomases 2006-12-21 03:46:55 -06:00 committed by Alexandre Julliard
parent 8485eb02dc
commit 23bb112b10
1 changed files with 17 additions and 6 deletions

View File

@ -148,6 +148,10 @@ typedef struct {
DWORD tickCountMS; /* time in MS of last AudioUnit callback */ DWORD tickCountMS; /* time in MS of last AudioUnit callback */
pthread_mutex_t lock; /* synchronization stuff */ pthread_mutex_t lock; /* synchronization stuff */
BOOL trace_on;
BOOL warn_on;
BOOL err_on;
} WINE_WAVEOUT; } WINE_WAVEOUT;
typedef struct { typedef struct {
@ -722,6 +726,10 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwo->dwPlayedTotal = 0; wwo->dwPlayedTotal = 0;
wwo->dwWrittenTotal = 0; wwo->dwWrittenTotal = 0;
wwo->trace_on = TRACE_ON(wave);
wwo->warn_on = WARN_ON(wave);
wwo->err_on = ERR_ON(wave);
pthread_mutex_unlock(&wwo->lock); pthread_mutex_unlock(&wwo->lock);
retval = wodNotifyClient(wwo, WOM_OPEN, 0L, 0L); retval = wodNotifyClient(wwo, WOM_OPEN, 0L, 0L);
@ -846,7 +854,7 @@ static void wodHelper_BeginWaveHdr(WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
{ {
wwo->state = WINE_WS_STOPPED; wwo->state = WINE_WS_STOPPED;
status = AudioOutputUnitStop(wwo->audioUnit); status = AudioOutputUnitStop(wwo->audioUnit);
if (status) if (status && wwo->err_on)
fprintf(stderr, "err:winecoreaudio:wodHelper_BeginWaveHdr AudioOutputUnitStop return %c%c%c%c\n", fprintf(stderr, "err:winecoreaudio:wodHelper_BeginWaveHdr AudioOutputUnitStop return %c%c%c%c\n",
(char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status); (char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
} }
@ -857,6 +865,7 @@ static void wodHelper_BeginWaveHdr(WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
{ {
status = AudioOutputUnitStart(wwo->audioUnit); status = AudioOutputUnitStart(wwo->audioUnit);
if (status) { if (status) {
if (wwo->err_on)
fprintf(stderr, "err:winecoreaudio:AudioOutputUnitStart return %c%c%c%c\n", fprintf(stderr, "err:winecoreaudio:AudioOutputUnitStart return %c%c%c%c\n",
(char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status); (char) (status >> 24), (char) (status >> 16), (char) (status >> 8), (char) status);
} }
@ -867,9 +876,11 @@ static void wodHelper_BeginWaveHdr(WINE_WAVEOUT* wwo, LPWAVEHDR lpWaveHdr)
{ {
if (wwo->lpLoopPtr) if (wwo->lpLoopPtr)
{ {
fprintf(stderr, "trace:winecoreaudio:wodHelper_BeginWaveHdr Already in a loop. Discarding loop on this header (%p)\n", lpWaveHdr); if (wwo->warn_on)
fprintf(stderr, "warn:winecoreaudio:wodHelper_BeginWaveHdr Already in a loop. Discarding loop on this header (%p)\n", lpWaveHdr);
} else } else
{ {
if (wwo->trace_on)
fprintf(stderr, "trace:winecoreaudio:wodHelper_BeginWaveHdr Starting loop (%dx) with %p\n", lpWaveHdr->dwLoops, lpWaveHdr); fprintf(stderr, "trace:winecoreaudio:wodHelper_BeginWaveHdr Starting loop (%dx) with %p\n", lpWaveHdr->dwLoops, lpWaveHdr);
wwo->lpLoopPtr = lpWaveHdr; wwo->lpLoopPtr = lpWaveHdr;