From 54402a7c82017ec844a971b4a87c318713e3372b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Mon, 12 Dec 2011 10:20:49 -0600 Subject: [PATCH] winealsa.drv: Request ALSA period time to match MMDevAPI period time. --- dlls/winealsa.drv/mmdevdrv.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index dcf7d3261db..e79a7b62b6c 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -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)){ -- 2.11.4.GIT