Maarten Lankhorst : dsound: Fix overshot calculations.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Sep 11 07:28:47 CDT 2007


Module: wine
Branch: master
Commit: 0c4ec8a1ccc352e15e447c927cb146cb000075c2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c4ec8a1ccc352e15e447c927cb146cb000075c2

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Wed Sep  5 13:54:33 2007 +0200

dsound: Fix overshot calculations.

---

 dlls/dsound/primary.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index f358aec..ce2f943 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -173,7 +173,7 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
 			buflen = ds_hel_buflen;
 		else /* In case we move from hw accelerated to waveout */
 			buflen = device->buflen;
-		buflen -= ds_hel_buflen % device->pwfx->nBlockAlign;
+		buflen -= buflen % device->pwfx->nBlockAlign;
 
 		TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
 
@@ -223,11 +223,13 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device)
 			}
 		}
 
-		overshot = device->buflen % device->helfrags;
+		overshot = device->buflen % device->fraglen;
 		/* sanity */
 		if(overshot)
 		{
-			WARN("helfrags (%d x %d) doesn't fit entirely in buflen (%d) overshot: %d\n", device->helfrags, device->fraglen, device->buflen, overshot);
+			overshot -= overshot % device->pwfx->nBlockAlign;
+			if (overshot)
+				WARN("helfrags (%d x %d) doesn't fit entirely in buflen (%d) overshot: %d\n", device->helfrags, device->fraglen, device->buflen, overshot);
 			device->pwave[device->helfrags - 1].dwBufferLength += overshot;
 		}
 




More information about the wine-cvs mailing list