=?UTF-8?Q?J=C3=B6rg=20H=C3=B6hle=20?=: winealsa.drv: Request ALSA period time to match MMDevAPI period time.

Alexandre Julliard julliard at winehq.org
Wed Dec 21 12:38:08 CST 2011


Module: wine
Branch: master
Commit: 54402a7c82017ec844a971b4a87c318713e3372b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=54402a7c82017ec844a971b4a87c318713e3372b

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Mon Dec 12 10:20:49 2011 -0600

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

---

 dlls/winealsa.drv/mmdevdrv.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index dcf7d32..e79a7b6 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)){




More information about the wine-cvs mailing list