openbsd-ports/audio/libmikmod/patches/patch-drivers_drv_wav_c
pvalchev 6c8b7b6f17 Fix corrupted 16bit .wav files generation on big endian platforms; from unzel miod
Bump patchlevel to p3 to distinguish fixed version
2003-06-16 04:30:57 +00:00

22 lines
568 B
Plaintext

$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;
}