Ken,
I was please to see your recent changes to winecoreaudio. In my
quest for audio bugs, when I reviewed the code, I found the
following which I believe is wrong or I don't understand.
Maybe you could look at it?
BTW, the code and comments are the same in both wineoss.drv and
winecoreaudio.drv.
In audio.c/wodPause:
/* The order of the following operations is important since we
can't hold
* the mutex while we make an Audio Unit call. Stop the Audio Unit
before
* setting the PAUSED state.
That's indeed what the code below does.
* Although we can be in PAUSED
* state with the Audio Unit still running,
Quite to the contrary, PAUSED state is only set after the unit stopped.
* that's harmless because the
* render callback will just produce silence.
I can't comment on that.
The code is (error checking not shown):
status = AudioOutputUnitStop(wwo->audioUnit);
OSSpinLockLock(&wwo->lock);
if (wwo->state == WINE_WS_PLAYING)
wwo->state = WINE_WS_PAUSED;
OSSpinLockUnlock(&wwo->lock);
In audio.c/wodRestart:
* In wodRestart, the order is reversed.
Indeed.
* This guarantees that we can't get into a situation where the
state is
* PLAYING but the Audio Unit isn't running.
Quite to the contrary, PLAYING state is reached yet
AudioOutputUnitStart is only called a few instructions afterwards.
Likewise above, it's stopped and PLAYING state is only unset afterwards.
OSSpinLockLock(&wwo->lock);
if (wwo->state == WINE_WS_PAUSED)
wwo->state = WINE_WS_PLAYING;
OSSpinLockUnlock(&wwo->lock);
status = AudioOutputUnitStart(wwo->audioUnit);
Is my understanding wrong?
Does the code need be changed to reflect the comments?
Do the comments need correction?
Thanks,
Jorg Hohle