wineoss mixer fix rounding bug
Robert Reif
reif at earthlink.net
Fri Aug 27 14:30:44 CDT 2004
Round results of conversions between OSS and windows values.
-------------- next part --------------
Index: dlls/winmm/wineoss/mixer.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/wineoss/mixer.c,v
retrieving revision 1.26
diff -u -r1.26 mixer.c
--- dlls/winmm/wineoss/mixer.c 22 Aug 2004 22:26:48 -0000 1.26
+++ dlls/winmm/wineoss/mixer.c 27 Aug 2004 19:24:09 -0000
@@ -1091,15 +1102,15 @@
{
case 1:
/* mono... so R = L */
- mcdu->dwValue = (LOBYTE(LOWORD(val)) * 65536L) / 100;
+ mcdu->dwValue = ((LOBYTE(LOWORD(val)) * 65536.0) / 100.0) + 0.5;
TRACE("Reading RL = %ld\n", mcdu->dwValue);
break;
case 2:
/* stereo, left is paDetails[0] */
- mcdu->dwValue = (LOBYTE(LOWORD(val)) * 65536L) / 100;
+ mcdu->dwValue = ((LOBYTE(LOWORD(val)) * 65536.0) / 100.0) + 0.5;
TRACE("Reading L = %ld\n", mcdu->dwValue);
mcdu++;
- mcdu->dwValue = (HIBYTE(LOWORD(val)) * 65536L) / 100;
+ mcdu->dwValue = ((HIBYTE(LOWORD(val)) * 65536.0) / 100.0) + 0.5;
TRACE("Reading R = %ld\n", mcdu->dwValue);
break;
default:
@@ -1290,10 +1301,10 @@
case 2:
/* stereo, left is paDetails[0] */
TRACE("Setting L to %ld\n", mcdu->dwValue);
- val = ((mcdu->dwValue * 100) >> 16);
+ val = ((mcdu->dwValue * 100.0) / 65536.0) + 0.5;
mcdu++;
TRACE("Setting R to %ld\n", mcdu->dwValue);
- val += ((mcdu->dwValue * 100) >> 16) << 8;
+ val += (int)(((mcdu->dwValue * 100) / 65536.0) + 0.5) << 8;
break;
default:
WARN("Unsupported cChannels (%ld)\n", lpmcd->cChannels);
More information about the wine-patches
mailing list