dsound: Fix IDirectSoundBuffer_GetPosition.

This commit is contained in:
Maarten Lankhorst 2007-10-01 15:07:59 +02:00 committed by Alexandre Julliard
parent 8f6f252ee8
commit 546447152e
1 changed files with 8 additions and 11 deletions

View File

@ -923,21 +923,18 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
EnterCriticalSection(&This->device->lock);
pos = (DWORD_PTR)This->device->pwave[This->device->index].lpData - (DWORD_PTR)This->device->buffer;
TRACE("old This->device->state=%s\n",captureStateString[This->device->state]);
if (lpdwCapturePosition)
*lpdwCapturePosition = pos;
*lpdwCapturePosition = (This->device->pwave[This->device->index].dwBufferLength + pos) % This->device->buflen;
if (lpdwReadPosition)
*lpdwReadPosition = (This->device->pwave[This->device->index].dwBufferLength + pos) % This->device->buflen;
*lpdwReadPosition = pos;
LeaveCriticalSection(&This->device->lock);
if (lpdwCapturePosition) TRACE("*lpdwCapturePosition=%d\n",*lpdwCapturePosition);
if (lpdwReadPosition) TRACE("*lpdwReadPosition=%d\n",*lpdwReadPosition);
} else {
WARN("no driver\n");
hres = DSERR_NODRIVER;
}
TRACE("cappos=%d readpos=%d\n", (lpdwCapturePosition?*lpdwCapturePosition:-1), (lpdwReadPosition?*lpdwReadPosition:-1));
TRACE("returning %08x\n", hres);
return hres;
}