winealsa.drv: Request ALSA period time to match MMDevAPI period time.

This commit is contained in:
Jörg Höhle 2011-12-12 10:20:49 -06:00 committed by Alexandre Julliard
parent 8c9a67934b
commit 54402a7c82
1 changed files with 8 additions and 8 deletions

View File

@ -939,14 +939,12 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
goto exit; goto exit;
} }
alsa_period_us = duration / 100; /* duration / 10 converted to us */ This->mmdev_period_rt = period;
alsa_period_us = This->mmdev_period_rt / 10;
if((err = snd_pcm_hw_params_set_period_time_near(This->pcm_handle, if((err = snd_pcm_hw_params_set_period_time_near(This->pcm_handle,
This->hw_params, &alsa_period_us, NULL)) < 0){ This->hw_params, &alsa_period_us, NULL)) < 0)
WARN("Unable to set period time near %u: %d (%s)\n", alsa_period_us, WARN("Unable to set period time near %u: %d (%s)\n", alsa_period_us,
err, snd_strerror(err)); err, snd_strerror(err));
hr = E_FAIL;
goto exit;
}
if((err = snd_pcm_hw_params(This->pcm_handle, This->hw_params)) < 0){ if((err = snd_pcm_hw_params(This->pcm_handle, This->hw_params)) < 0){
WARN("Unable to set hw params: %d (%s)\n", err, snd_strerror(err)); WARN("Unable to set hw params: %d (%s)\n", err, snd_strerror(err));
@ -960,7 +958,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
hr = E_FAIL; hr = E_FAIL;
goto exit; goto exit;
} }
TRACE("alsa_period_frames: %lu\n", This->alsa_period_frames);
if((err = snd_pcm_hw_params_get_buffer_size(This->hw_params, if((err = snd_pcm_hw_params_get_buffer_size(This->hw_params,
&This->alsa_bufsize_frames)) < 0){ &This->alsa_bufsize_frames)) < 0){
@ -1008,8 +1005,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
goto exit; goto exit;
} }
This->mmdev_period_rt = period;
/* Check if the ALSA buffer is so small that it will run out before /* Check if the ALSA buffer is so small that it will run out before
* the next MMDevAPI period tick occurs. Allow a little wiggle room * the next MMDevAPI period tick occurs. Allow a little wiggle room
* with 120% of the period time. */ * with 120% of the period time. */
@ -1063,6 +1058,11 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
This->initted = TRUE; This->initted = TRUE;
TRACE("ALSA period: %lu frames\n", This->alsa_period_frames);
TRACE("ALSA buffer: %lu frames\n", This->alsa_bufsize_frames);
TRACE("MMDevice period: %u frames\n", This->mmdev_period_frames);
TRACE("MMDevice buffer: %u frames\n", This->bufsize_frames);
exit: exit:
HeapFree(GetProcessHeap(), 0, sw_params); HeapFree(GetProcessHeap(), 0, sw_params);
if(FAILED(hr)){ if(FAILED(hr)){