Commit b634666e authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

mmdevapi: Make buffer size divisible by number of periods.

parent e6f816c9
......@@ -935,7 +935,7 @@ static void test_clock(int share)
if (share)
ok(gbsize == bufsize,
"BufferSize %u at rate %u\n", gbsize, pwfx->nSamplesPerSec);
else todo_wine
else
ok(gbsize == parts * fragment || gbsize == MulDiv(bufsize, 1, 1024) * 1024,
"BufferSize %u misfits fragment size %u at rate %u\n", gbsize, fragment, pwfx->nSamplesPerSec);
......
......@@ -1416,6 +1416,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
* ALSA period 220 vs. 221 frames in mmdevapi and
* buffer 883 vs. 2205 frames in mmdevapi! */
This->bufsize_frames = MulDiv(duration, fmt->nSamplesPerSec, 10000000);
if(mode == AUDCLNT_SHAREMODE_EXCLUSIVE)
This->bufsize_frames -= This->bufsize_frames % This->mmdev_period_frames;
This->hidden_frames = This->alsa_period_frames + This->mmdev_period_frames +
MulDiv(fmt->nSamplesPerSec, EXTRA_SAFE_RT, 10000000);
......
......@@ -1235,6 +1235,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
This->period_frames = MulDiv(period, This->fmt->nSamplesPerSec, 10000000);
This->bufsize_frames = MulDiv(duration, fmt->nSamplesPerSec, 10000000);
if(mode == AUDCLNT_SHAREMODE_EXCLUSIVE)
This->bufsize_frames -= This->bufsize_frames % This->period_frames;
if(This->dataflow == eCapture){
int i, nbuffs = (This->bufsize_frames / This->period_frames) + 1;
......
......@@ -1099,6 +1099,8 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
This->period_frames = MulDiv(fmt->nSamplesPerSec, period, 10000000);
This->bufsize_frames = MulDiv(duration, fmt->nSamplesPerSec, 10000000);
if(mode == AUDCLNT_SHAREMODE_EXCLUSIVE)
This->bufsize_frames -= This->bufsize_frames % This->period_frames;
This->local_buffer = HeapAlloc(GetProcessHeap(), 0,
This->bufsize_frames * fmt->nBlockAlign);
if(!This->local_buffer){
......
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