diff --git a/dlls/winmm/winealsa/Makefile.in b/dlls/winmm/winealsa/Makefile.in
diff --git a/dlls/winmm/winealsa/audio.c b/dlls/winmm/winealsa/audio.c
index 6043680..1fd76b2 100644
--- a/dlls/winmm/winealsa/audio.c
+++ b/dlls/winmm/winealsa/audio.c
@@ -70,11 +70,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wave);
 
 #ifdef HAVE_ALSA
 
-/* internal ALSALIB functions */
-/* FIXME:  we shouldn't be using internal functions... */
-snd_pcm_uframes_t _snd_pcm_mmap_hw_ptr(snd_pcm_t *pcm);
-
-
 /* state diagram for waveOut writing:
  *
  * +---------+-------------+---------------+---------------------------------+
@@ -2627,7 +2622,6 @@ #undef EXIT_ON_ERROR
     	snd_pcm_hw_params_free(wwo->hw_params);
     wwo->hw_params = hw_params;
 
-
     return wodNotifyClient(wwo, WOM_OPEN, 0L, 0L);
 
 errexit:
@@ -3045,9 +3039,9 @@ struct IDsDriverBufferImpl
     DWORD                     mmap_buflen_bytes;
     snd_pcm_uframes_t         mmap_buflen_frames;
     snd_pcm_channel_area_t *  mmap_areas;
-    snd_async_handler_t *     mmap_async_handler;
     snd_pcm_uframes_t	      mmap_ppos; /* play position */
-    
+    HANDLE                    mmap_thread;
+
     /* Do we have a direct hardware buffer - SND_PCM_TYPE_HW? */
     int                       mmap_mode;
 };
@@ -3076,7 +3070,7 @@ static void DSDB_CheckXRUN(IDsDriverBuff
     }
 }
 
-static void DSDB_MMAPCopy(IDsDriverBufferImpl* pdbi, int mul)
+static void DSDB_MMAPCopy(IDsDriverBufferImpl* pdbi, const int mul)
 {
     WINE_WAVEDEV *     wwo = &(WOutDev[pdbi->drv->wDevID]);
     snd_pcm_uframes_t  period_size;
@@ -3104,7 +3098,7 @@ static void DSDB_MMAPCopy(IDsDriverBuffe
     EnterCriticalSection(&pdbi->mmap_crst);
 
     /* we want to commit the given number of periods, or the whole lot */
-    wanted = mul == 0 ? frames : period_size * 2;
+    wanted = (mul == 0 ? frames : period_size * mul);
 
     snd_pcm_mmap_begin(wwo->pcm, &areas, &ofs, &frames);
     if (areas != pdbi->mmap_areas || areas->addr != pdbi->mmap_areas->addr)
@@ -3131,16 +3125,52 @@ static void DSDB_MMAPCopy(IDsDriverBuffe
     LeaveCriticalSection(&pdbi->mmap_crst);
 }
 
-static void DSDB_PCMCallback(snd_async_handler_t *ahandler)
+static DWORD CALLBACK DBSB_MMAPStart(LPVOID data)
 {
-    int periods;
-    /* snd_pcm_t *               handle = snd_async_handler_get_pcm(ahandler); */
-    IDsDriverBufferImpl*      pdbi = snd_async_handler_get_callback_private(ahandler);
-    TRACE("callback called\n");
-    
-    /* Commit another block (the entire buffer if it's a direct hw buffer) */
-    periods = pdbi->mmap_mode == SND_PCM_TYPE_HW ? 0 : 1;
-    DSDB_MMAPCopy(pdbi, periods);
+    IDsDriverBufferImpl* pdbi = (IDsDriverBufferImpl*)data;
+    WINE_WAVEDEV *     wwo = &(WOutDev[pdbi->drv->wDevID]);
+
+/* If we have a direct hardware buffer, we can commit the whole lot
+ * immediately (periods = 0), otherwise we prime the queue with only
+ * 2 periods.
+ *
+ * Why 2? We want a small number so that we don't get ahead of the
+ * DirectSound mixer. But we don't want to ever let the buffer get
+ * completely empty - having 2 periods gives us time to commit another
+ * period when the first expires.
+ *
+ * The potential for buffer underrun is high, but that's the reality
+ * of using a translated buffer (the whole point of DirectSound is
+ * to provide direct access to the hardware).
+ *
+ * A better implementation would use the buffer Lock() and Unlock()
+ * methods to determine how far ahead we can commit, and to rewind if
+ * necessary.
+ * 
+ * If we talk directly to hardware, we can fill the buffer totally
+ */
+
+    const int bufferit = !(pdbi->mmap_mode == SND_PCM_TYPE_HW);
+
+    DSDB_MMAPCopy(pdbi, 2 * bufferit);
+
+    while (pdbi->mmap_thread)
+    {
+        if (snd_pcm_wait(wwo->pcm,-1) < 0)
+            break;
+        DSDB_MMAPCopy(pdbi, bufferit);
+    }
+    return 0;
+}
+
+/* Cancel running MMAP */
+static void DBSB_MMAPStop(IDsDriverBufferImpl* This)
+{
+    HANDLE Thread;
+    if (This->mmap_thread == NULL) return;
+    Thread = This->mmap_thread;
+    This->mmap_thread = NULL;
+    WaitForSingleObject(Thread, INFINITE);
 }
 
 /**
@@ -3208,19 +3238,13 @@ static int DSDB_CreateMMAP(IDsDriverBuff
     InitializeCriticalSection(&pdbi->mmap_crst);
     pdbi->mmap_crst.DebugInfo->Spare[0] = (DWORD_PTR)"WINEALSA_mmap_crst";
 
-    err = snd_async_add_pcm_handler(&pdbi->mmap_async_handler, wwo->pcm, DSDB_PCMCallback, pdbi);
-    if ( err < 0 )
-    {
-	ERR("add_pcm_handler failed. reason: %s\n", snd_strerror(err));
-	return DSERR_GENERIC;
-    }
-
     return DS_OK;
 }
 
 static void DSDB_DestroyMMAP(IDsDriverBufferImpl* pdbi)
 {
     TRACE("mmap buffer %p destroyed\n", pdbi->mmap_buffer);
+    DBSB_MMAPStop(pdbi);
     pdbi->mmap_areas = NULL;
     pdbi->mmap_buffer = NULL;
     pdbi->mmap_crst.DebugInfo->Spare[0] = 0;
@@ -3374,27 +3398,11 @@ static HRESULT WINAPI IDsDriverBufferImp
     }
     if ( state == SND_PCM_STATE_PREPARED )
     {
-	/* If we have a direct hardware buffer, we can commit the whole lot
-	 * immediately (periods = 0), otherwise we prime the queue with only
-	 * 2 periods.
-	 *
-	 * Why 2? We want a small number so that we don't get ahead of the
-	 * DirectSound mixer. But we don't want to ever let the buffer get
-	 * completely empty - having 2 periods gives us time to commit another
-	 * period when the first expires.
-	 *
-	 * The potential for buffer underrun is high, but that's the reality
-	 * of using a translated buffer (the whole point of DirectSound is
-	 * to provide direct access to the hardware).
-         * 
-         * A better implementation would use the buffer Lock() and Unlock()
-         * methods to determine how far ahead we can commit, and to rewind if
-         * necessary.
-	 */
-	int periods = This->mmap_mode == SND_PCM_TYPE_HW ? 0 : 2;
-	
-	DSDB_MMAPCopy(This, periods);
-	err = snd_pcm_start(wwo->pcm);
+        err = snd_pcm_start(wwo->pcm);
+        This->mmap_thread = CreateThread(NULL, 0, DBSB_MMAPStart, (LPVOID)(DWORD)This, 0, NULL);
+        if (This->mmap_thread == NULL)
+            return DSERR_GENERIC;
+        SetThreadPriority(This->mmap_thread, THREAD_PRIORITY_TIME_CRITICAL);
     }
     return DS_OK;
 }
@@ -3419,6 +3427,8 @@ static HRESULT WINAPI IDsDriverBufferImp
     	return DS_OK;
     }
 
+    DBSB_MMAPStop(This);
+
     if ( ( err = snd_pcm_drop(wwo->pcm)) < 0 )
     {
    	ERR("error while stopping pcm: %s\n", snd_strerror(err));
