Andrew Eikum : dsound: Fix fragment position calculations.

Alexandre Julliard julliard at winehq.org
Thu Oct 6 17:24:30 CDT 2011


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Thu Oct  6 09:35:07 2011 -0500

dsound: Fix fragment position calculations.

---

 dlls/dsound/mixer.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
index 936ea3e..8adbdff 100644
--- a/dlls/dsound/mixer.c
+++ b/dlls/dsound/mixer.c
@@ -788,7 +788,7 @@ static void DSOUND_WaveQueue(DirectSoundDevice *device, BOOL force)
 	device->pwqueue += prebuf_frags;
 
 	prebuf_frames = ((prebuf_frags + wave_fragpos > device->helfrags) ?
-			(prebuf_frags + wave_fragpos - device->helfrags) :
+			(device->helfrags - wave_fragpos) :
 			(prebuf_frags)) * device->fraglen / device->pwfx->nBlockAlign;
 
 	hr = IAudioRenderClient_GetBuffer(device->render, prebuf_frames, &buffer);
@@ -859,8 +859,8 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)
 		return;
 	}
 
-	pos_bytes = (clock_pos / (double)clock_freq) * device->pwfx->nSamplesPerSec *
-		device->pwfx->nBlockAlign;
+	pos_bytes = ceil(clock_pos * device->pwfx->nBlockAlign *
+		(clock_freq / (double)device->pwfx->nSamplesPerSec));
 
 	delta_frags = (pos_bytes - device->last_pos_bytes) / device->fraglen;
 	if(delta_frags > 0){




More information about the wine-cvs mailing list