Fix corrupted 16bit .wav files generation on big endian platforms; from unzel miod

Bump patchlevel to p3 to distinguish fixed version
This commit is contained in:
pvalchev 2003-06-16 04:30:57 +00:00
parent 67868669b6
commit 6c8b7b6f17
2 changed files with 23 additions and 2 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.5 2002/12/29 19:29:56 fgsch Exp $
# $OpenBSD: Makefile,v 1.6 2003/06/16 04:30:57 pvalchev Exp $
COMMENT= "mikmod sound library"
VERSION= 3.1.10
DISTNAME= libmikmod-${VERSION}
PKGNAME= ${DISTNAME}p2
PKGNAME= ${DISTNAME}p3
CATEGORIES= audio devel
HOMEPAGE= http://www.mikmod.org

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-drivers_drv_wav_c,v 1.1 2003/06/16 04:30:57 pvalchev Exp $
--- drivers/drv_wav.c.orig Sat Jan 12 18:00:14 2002
+++ drivers/drv_wav.c Sun Jun 15 22:26:13 2003
@@ -148,6 +148,17 @@ static void WAV_Update(void)
ULONG done;
done=VC_WriteBytes(audiobuffer,BUFFERSIZE);
+#if BYTE_ORDER == BIG_ENDIAN
+ if (md_mode & DMODE_16BITS) {
+ ULONG i;
+ SWORD *w = audiobuffer;
+
+ for (i = 0; i < done; i += 2) {
+ *w = ((*w & 0xff) << 8) | ((*w & 0xff00) >> 8);
+ w++;
+ }
+ }
+#endif
_mm_write_UBYTES(audiobuffer,done,wavout);
dumpsize+=done;
}