[Bug 14717] resampled sound is horrible

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Nov 6 09:54:29 CST 2011


http://bugs.winehq.org/show_bug.cgi?id=14717

--- Comment #219 from Alexander E. Patrakov <patrakov at gmail.com> 2011-11-06 09:54:29 CST ---
OK, I found that clicks appear due to the use of freqAccNext in
DSOUND_bufpos_to_secpos(). Applying ths patch removes them completely, but I am
not sure if the rationale in the comment above DSOUND_bufpos_to_secpos() is
valid.

--- a/dlls/dsound/mixer.c
+++ b/dlls/dsound/mixer.c
@@ -149,12 +149,12 @@ static DWORD DSOUND_bufpos_to_secpos(const
IDirectSoundBufferImpl *dsb, DWORD bu
        DWORD64 acc;

        framelen = bufpos/oAdv;
-       acc = framelen * (DWORD64)dsb->freqAdjust + (DWORD64)dsb->freqAccNext;
+       acc = framelen * (DWORD64)dsb->freqAdjust + (DWORD64)dsb->freqAcc;
        acc = acc >> DSOUND_FREQSHIFT;
        pos = (DWORD)acc * iAdv;
-       if (pos >= dsb->buflen)
-               /* Because of differences between freqAcc and freqAccNext, this
might happen */
-               pos = dsb->buflen - iAdv;
+//     if (pos >= dsb->buflen)
+//             /* Because of differences between freqAcc and freqAccNext, this
might happen */
+//             pos = dsb->buflen - iAdv;
        TRACE("Converted %d/%d to %d/%d\n", bufpos, dsb->tmp_buffer_len, pos,
dsb->buflen);
        return pos;
 }
@@ -472,10 +472,6 @@ static void DSOUND_MixToTemporary(const
IDirectSoundBufferImpl *dsb, DWORD tmp_l
        INT     size = tmp_len / oAdvance;
        DWORD freqAcc;

-       DWORD len = DSOUND_bufpos_to_secpos(dsb, dsb->buf_mixpos + tmp_len) -
dsb->sec_mixpos;
-
-       assert(dsb->sec_mixpos + len <= dsb->buflen);
-
        if (dsb->device->tmp_buffer_len < tmp_len || !dsb->device->tmp_buffer)
        {
                dsb->device->tmp_buffer_len = tmp_len;

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list