Maarten Lankhorst : dsound: Fix IDirectSoundBuffer_GetPosition.
Alexandre Julliard
julliard at winehq.org
Tue Oct 2 06:52:39 CDT 2007
Module: wine
Branch: master
Commit: 546447152e8fc828e609e3972e0e31a88b605ea9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=546447152e8fc828e609e3972e0e31a88b605ea9
Author: Maarten Lankhorst <maarten at codeweavers.com>
Date: Mon Oct 1 15:07:59 2007 +0200
dsound: Fix IDirectSoundBuffer_GetPosition.
---
dlls/dsound/capture.c | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c
index f0b230d..9de2ecd 100644
--- a/dlls/dsound/capture.c
+++ b/dlls/dsound/capture.c
@@ -919,25 +919,22 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
if (hres != DS_OK)
WARN("IDsCaptureDriverBuffer_GetPosition failed\n");
} else if (This->device->hwi) {
- DWORD pos;
+ DWORD pos;
- 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]);
+ EnterCriticalSection(&This->device->lock);
+ pos = (DWORD_PTR)This->device->pwave[This->device->index].lpData - (DWORD_PTR)This->device->buffer;
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 {
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;
}
More information about the wine-cvs
mailing list