From 569db3c81210ff0b4f81128b78a68f1e236570a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Villac=C3=ADs=20Lasso?= Date: Fri, 22 Apr 2005 19:05:34 +0000 Subject: [PATCH] Perform one more commit in ALSA non-emulation if there are still frames to be transmitted. --- dlls/winmm/winealsa/audio.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/dlls/winmm/winealsa/audio.c b/dlls/winmm/winealsa/audio.c index 9ee045e9a40..eb4852a8d58 100644 --- a/dlls/winmm/winealsa/audio.c +++ b/dlls/winmm/winealsa/audio.c @@ -2452,7 +2452,31 @@ static void DSDB_MMAPCopy(IDsDriverBufferImpl* pdbi) avail = snd_pcm_avail_update(wwo->handle); } - } + + if (avail > 0) + { + const snd_pcm_channel_area_t *areas; + snd_pcm_uframes_t ofs; + snd_pcm_uframes_t frames; + int err; + + frames = avail; + + EnterCriticalSection(&pdbi->mmap_crst); + + snd_pcm_mmap_begin(wwo->handle, &areas, &ofs, &frames); + if (areas != pdbi->mmap_areas || areas->addr != pdbi->mmap_areas->addr) + FIXME("Can't access sound driver's buffer directly.\n"); + err = snd_pcm_mmap_commit(wwo->handle, ofs, frames); + + LeaveCriticalSection(&pdbi->mmap_crst); + + if ( err != (snd_pcm_sframes_t) frames) + ERR("mmap partially failed.\n"); + + avail = snd_pcm_avail_update(wwo->handle); + } +} static void DSDB_PCMCallback(snd_async_handler_t *ahandler) {