mmdevapi: Make buffer size divisible by number of periods.
This commit is contained in:
parent
e6f816c99b
commit
b634666e13
|
@ -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){
|
||||
|
|
Loading…
Reference in New Issue