[Bug 14717] resampled sound is horrible

wine-bugs at winehq.org wine-bugs at winehq.org
Sun Dec 26 10:35:47 CST 2010


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

--- Comment #75 from Krzysztof Nikiel <zzdz2 at yahoo.pl> 2010-12-26 10:35:45 CST ---
The following patch should fix 24-bit output (not tested).




diff --git a/dlls/dsound/Makefile.in b/dlls/dsound/Makefile.in
index 2c114e0..3c777a6 100644
--- a/dlls/dsound/Makefile.in
+++ b/dlls/dsound/Makefile.in
@@ -25,7 +25,7 @@ firtab.h: mkfir
     ./$< > $@
     $(RM) $<

-resample.c: firtab.h
+depend: firtab.h

 @MAKE_DLL_RULES@

diff --git a/dlls/dsound/resample.c b/dlls/dsound/resample.c
index 0a3128b..c785c1c 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,10 +105,9 @@ static inline void putsample(LPBYTE buf, INT bps, sample_t
smp)
     *((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;

-- 
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