From c60583ab8b53a87ac41e16cb563e15261d9cbd74 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 17 Oct 2011 14:52:03 -0500 Subject: [PATCH] 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 b1925d5a6ff..df6da13a772 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 91556340f20..c17035889ee 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); -- 2.11.4.GIT