[PATCH 13/13] dsound: Removed unused/conflicting code/vars. Added call to DSOUND_PullBuffer().

Krzysztof Nikiel knik00 at gmail.com
Fri Feb 11 03:34:31 CST 2011


---
 dlls/dsound/mixer.c |   24 +++++-------------------
 1 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c
index 3542bdb..4e9e2c9 100644
--- a/dlls/dsound/mixer.c
+++ b/dlls/dsound/mixer.c
@@ -223,17 +223,15 @@ static DWORD DSOUND_MixToPrimary(const
DirectSoundDevice *device, DWORD writepos
                 DSOUND_CheckEvent(dsb, 0, 0);
             } else if (dsb->state != STATE_STOPPED) {

-                /* if recovering, reset the mix position */
-                if ((dsb->state == STATE_STARTING) || recover) {
-                    dsb->primary_mixpos = writepos;
-                }
-
                 /* if the buffer was starting, it must be playing now */
                 if (dsb->state == STATE_STARTING)
                     dsb->state = STATE_PLAYING;

                 /* mix next buffer into the main buffer */
-                len = DSOUND_MixOne(dsb, writepos, mixlen);
+                len = DSOUND_PullBuffer(dsb, writepos, mixlen);
+                if (len != mixlen)
+                    ERR("Only %d/%d bytes from buffer %p\n", len, mixlen,
dsb);
+

                 if (!minlen) minlen = len;

@@ -333,7 +331,7 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)

     if (device->priolevel != DSSCL_WRITEPRIMARY) {
         BOOL recover = FALSE, all_stopped = FALSE;
-        DWORD playpos, writepos, writelead, maxq, frag, prebuff_max,
prebuff_left, size1, size2, mixplaypos, mixplaypos2;
+        DWORD playpos, writepos, writelead, maxq, frag, prebuff_max,
prebuff_left, size1, size2;
         LPVOID buf1, buf2;
         BOOL lock = (device->hwbuf && !(device->drvdesc.dwFlags &
DSDDESC_DONTNEEDPRIMARYLOCK));
         BOOL mustlock = FALSE;
@@ -352,9 +350,6 @@ static void DSOUND_PerformMix(DirectSoundDevice *device)

playpos,writepos,device->playpos,device->mixpos,device->buflen);
         assert(device->playpos < device->buflen);

-        mixplaypos = DSOUND_bufpos_to_mixpos(device, device->playpos);
-        mixplaypos2 = DSOUND_bufpos_to_mixpos(device, playpos);
-
         /* calc maximum prebuff */
         prebuff_max = (device->prebuf * device->fraglen);
         if (!device->hwbuf && playpos + prebuff_max >= device->helfrags *
device->fraglen)
@@ -425,15 +420,6 @@ static void DSOUND_PerformMix(DirectSoundDevice
*device)
         /* do the mixing */
         frag = DSOUND_MixToPrimary(device, writepos, maxq, mustlock,
recover, &all_stopped);

-        if (frag + writepos > device->buflen)
-        {
-            DWORD todo = device->buflen - writepos;
-            device->normfunction(device->mix_buffer +
DSOUND_bufpos_to_mixpos(device, writepos), device->buffer + writepos, todo);
-            device->normfunction(device->mix_buffer, device->buffer, frag -
todo);
-        }
-        else
-            device->normfunction(device->mix_buffer +
DSOUND_bufpos_to_mixpos(device, writepos), device->buffer + writepos, frag);
-
         /* update the mix position, taking wrap-around into account */
         device->mixpos = writepos + frag;
         device->mixpos %= device->buflen;
-- 
1.7.2.3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20110211/148ad30b/attachment.htm>


More information about the wine-patches mailing list