diff src/sound.c @ 4592:b69bbf9b1044

[gaim-migrate @ 4876] Nathan Conrad pointed out that sounds were in pretty lousy shape on those wacky big-endian monsters. This should take care of that, and not hurt us little-endian guys in the process. Oh, and there was a chance that sound wouldn't get initialized in weird situations. This should fix that. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 20 Feb 2003 05:00:27 +0000
parents 4b1e24835bbf
children 77b04219f3e2
line wrap: on
line diff
--- a/src/sound.c	Thu Feb 20 01:36:50 2003 +0000
+++ b/src/sound.c	Thu Feb 20 05:00:27 2003 +0000
@@ -34,6 +34,10 @@
 #include <mmsystem.h>
 #endif
 
+#ifdef HAVE_ENDIAN_H
+#include <endian.h>
+#endif
+
 #ifdef USE_AO
 #include <ao/ao.h>
 #include <audiofile.h>
@@ -229,10 +233,15 @@
 			afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK,
 					AF_SAMPFMT_TWOSCOMP, format.bits);
 
-			if(afGetByteOrder(file, AF_DEFAULT_TRACK) == AF_BYTEORDER_BIGENDIAN)
-				format.byte_format = AO_FMT_BIG;
-			else
-				format.byte_format = AO_FMT_LITTLE;
+#if __BYTE_ORDER == __BIG_ENDIAN
+			format.byte_format = AO_FMT_BIG;
+			afSetVirtualByteOrder(file, AF_DEFAULT_TRACK,
+					AF_BYTEORDER_BIGENDIAN);
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+			format.byte_format = AO_FMT_LITTLE;
+			afSetVirtualByteOrder(file, AF_DEFAULT_TRACK,
+					AF_BYTEORDER_LITTLEENDIAN);
+#endif
 
 			bytes_per_frame = format.bits * format.channels / 8;