http://bugs.winehq.org/show_bug.cgi?id=14717
Andrew Eikum aeikum@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #38186|0 |1 is obsolete| |
--- Comment #261 from Andrew Eikum aeikum@codeweavers.com 2012-01-03 15:36:31 CST --- Created attachment 38246 --> http://bugs.winehq.org/attachment.cgi?id=38246 Speex resampler again
Another patchset, possibly final. A couple of changes:
I removed the "convert to float" patch, and instead just removed freqAdjust entirely in the patch that introduces Speex. It wasn't really used anyway.
I made one change to each of the first two patches. The first patch has this new diff hunk:
diff --git a/dlls/dsound/dsound_convert.c b/dlls/dsound/dsound_convert.c index 63e3dbe..dd982c6 100644 --- a/dlls/dsound/dsound_convert.c +++ b/dlls/dsound/dsound_convert.c @@ -66,8 +66,8 @@ static inline void src_advance(const void **src, UINT stride, INT *count, UINT * ULONG adv = (*freqAcc >> DSOUND_FREQSHIFT); *freqAcc &= (1 << DSOUND_FREQSHIFT) - 1; *(const char **)src += adv * stride; - *count -= adv; } + *count -= 1; }
The original patch changed the "count" (aka "size") variable to be in terms of the number of output frames, but the conversion functions still decremeted it in step with the src parameter. That caused data corruption and crashes, which this diff fixes.
The second patch was changed as follows (diff of a diff):
+static inline void cp_fields(const IDirectSoundBufferImpl *dsb, const BYTE *ibuf, UINT istride, UINT ostride, UINT count, UINT freqAcc, UINT adj) { DirectSoundDevice *device = dsb->device; - INT istep = dsb->pwfx->wBitsPerSample / 8, ostep = device->pwfx->wBitsPerSample / 8; + float value; + ULONG adv; -+ DWORD ipos = 0, opos = 0; ++ DWORD ipos = dsb->sec_mixpos, opos = 0;
since the get() functions work on (dsb->buff+ipos), not on the passed ibuf value (which is actually unused, and removed in the following patch. perhaps the following patch should be squashed? it's quite small).
Concerning channel conversions, I believe the patchset here more flexible than the old channel conversion. The old code supported (secondary -> primary): n -> n 6 -> 2 2 -> 8 (hack, first 2 only) 2 -> 6 (hack, first 2 only) 2 -> 1 1 -> 2 silence (catchall)
While the new code supports: n -> n 1 -> 2 n -> 1 n -> 2 (catchall)
I tested each patch against the dsound tests and four applications (pikachugame.exe, Dracula Origin Demo, Plants Vs Zombies Demo, and HighwayPursuit). The entire patch sequence together has been tested on my computer against many more applications in addition to those.