Commit 0c4ec8a1 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

dsound: Fix overshot calculations.

parent c333402b
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment