Andrew Eikum : dsound: Fix type conversion problems.

Alexandre Julliard julliard at winehq.org
Tue Oct 18 12:56:26 CDT 2011


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Mon Oct 17 14:52:03 2011 -0500

dsound: Fix type conversion problems.

---

 dlls/dsound/mixer.c   |    4 ++--
 dlls/dsound/primary.c |    3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
index b1925d5..df6da13 100644
--- a/dlls/dsound/mixer.c
+++ b/dlls/dsound/mixer.c
@@ -859,8 +859,8 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
 		return;
 	}
 
-	pos_bytes = ceil(clock_pos * device->pwfx->nBlockAlign *
-		(clock_freq / (double)device->pwfx->nSamplesPerSec));
+	pos_bytes = (clock_pos * device->pwfx->nBlockAlign * clock_freq) /
+        device->pwfx->nSamplesPerSec;
 
 	delta_frags = (pos_bytes - device->last_pos_bytes) / device->fraglen;
 	if(delta_frags > 0){
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index 9155634..c170358 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -115,7 +115,8 @@ HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave)
     }
 
     prebuf_frames = device->prebuf * DSOUND_fraglen(device->pwfx->nSamplesPerSec, device->pwfx->nBlockAlign) / device->pwfx->nBlockAlign;
-    prebuf_rt = (prebuf_frames / (double)device->pwfx->nSamplesPerSec) * 10000000;
+    prebuf_rt = (10000000 * (UINT64)prebuf_frames) / device->pwfx->nSamplesPerSec;
+
     hres = IAudioClient_Initialize(device->client,
             AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST,
             prebuf_rt, 50000, device->pwfx, NULL);




More information about the wine-cvs mailing list