http://bugs.winehq.org/show_bug.cgi?id=14717
--- Comment #95 from Alexander E. Patrakov patrakov@gmail.com 2010-12-31 06:07:03 CST --- (In reply to comment #76)
diff --git a/dlls/dsound/resample.c b/dlls/dsound/resample.c index 0a3128b..03fcf6f 100644 --- a/dlls/dsound/resample.c +++ b/dlls/dsound/resample.c @@ -58,6 +58,8 @@ static fir_t *g_fir[] = { };
+#define SAMPLE24(p) (*((BYTE*)p)|*((BYTE*)p+1)<<8|*((CHAR*)p+2)<<16)
static inline sample_t getsample(LPBYTE buf, INT bps) { sample_t tmp; @@ -72,8 +74,7 @@ static inline sample_t getsample(LPBYTE buf, INT bps) tmp = *((SHORT *) buf); break; case 3:
- tmp = *((BYTE *) buf) | *((BYTE *) (buf + 1)) << 8 |
*((BYTE *) (buf + 2)) << 16;
- tmp = SAMPLE24(buf); tmp *= (1.0 / 256.0); break; case 4:
@@ -104,15 +105,14 @@ *((SHORT *) buf) = ismp; break; case 3:
- CLIPSAMPLE(smp, (double) 0x7fff); ismp = lrint(smp * 256.0);
- ismp += *((BYTE *) buf) | *((BYTE *) (buf + 1)) << 8 |
*((BYTE *) (buf + 2)) << 16;
- ismp += SAMPLE24(buf);
- CLIPSAMPLE(ismp, 0x7fffff); *((BYTE *) buf) = ismp & 0xff; ismp >>= 8;
- *((BYTE *) (buf + 1)) = ismp & 0xff;
- *((BYTE *) buf + 1) = ismp & 0xff; ismp >>= 8;
- *((BYTE *) (buf + 2)) = ismp & 0xff;
- *((BYTE *) buf + 2) = ismp & 0xff; break; case 4: CLIPSAMPLE(smp, (double) 0x7fff);
As I said, I could not test it, only read. However, in my opinion, the new code for acessing 24-bit samples is correct with the possible exception that it can be dead.