Skip to content
Snippets Groups Projects
Commit 54402a7c authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard
Browse files

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

parent 8c9a6793
No related branches found
No related tags found
No related merge requests found
......@@ -939,14 +939,12 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
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,
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,
err, snd_strerror(err));
hr = E_FAIL;
goto exit;
}
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));
......@@ -960,7 +958,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
hr = E_FAIL;
goto exit;
}
TRACE("alsa_period_frames: %lu\n", This->alsa_period_frames);
if((err = snd_pcm_hw_params_get_buffer_size(This->hw_params,
&This->alsa_bufsize_frames)) < 0){
......@@ -1008,8 +1005,6 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
goto exit;
}
This->mmdev_period_rt = period;
/* 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
* with 120% of the period time. */
......@@ -1063,6 +1058,11 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
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:
HeapFree(GetProcessHeap(), 0, sw_params);
if(FAILED(hr)){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment