Skip to content
Snippets Groups Projects
Commit 54644715 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard
Browse files

dsound: Fix IDirectSoundBuffer_GetPosition.

parent 8f6f252e
No related branches found
No related tags found
No related merge requests found
...@@ -919,25 +919,22 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition( ...@@ -919,25 +919,22 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
if (hres != DS_OK) if (hres != DS_OK)
WARN("IDsCaptureDriverBuffer_GetPosition failed\n"); WARN("IDsCaptureDriverBuffer_GetPosition failed\n");
} else if (This->device->hwi) { } else if (This->device->hwi) {
DWORD pos; DWORD pos;
EnterCriticalSection(&This->device->lock); EnterCriticalSection(&This->device->lock);
pos = (DWORD_PTR)This->device->pwave[This->device->index].lpData - (DWORD_PTR)This->device->buffer; 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) if (lpdwCapturePosition)
*lpdwCapturePosition = pos; *lpdwCapturePosition = (This->device->pwave[This->device->index].dwBufferLength + pos) % This->device->buflen;
if (lpdwReadPosition)
*lpdwReadPosition = pos;
LeaveCriticalSection(&This->device->lock);
if (lpdwReadPosition)
*lpdwReadPosition = (This->device->pwave[This->device->index].dwBufferLength + pos) % This->device->buflen;
LeaveCriticalSection(&This->device->lock);
if (lpdwCapturePosition) TRACE("*lpdwCapturePosition=%d\n",*lpdwCapturePosition);
if (lpdwReadPosition) TRACE("*lpdwReadPosition=%d\n",*lpdwReadPosition);
} else { } else {
WARN("no driver\n"); WARN("no driver\n");
hres = DSERR_NODRIVER; hres = DSERR_NODRIVER;
} }
TRACE("cappos=%d readpos=%d\n", (lpdwCapturePosition?*lpdwCapturePosition:-1), (lpdwReadPosition?*lpdwReadPosition:-1));
TRACE("returning %08x\n", hres); TRACE("returning %08x\n", hres);
return hres; return hres;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment