changeset 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 5ef293db2582
children 26992c8e8e21
files src/gaimrc.c src/sound.c
diffstat 2 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gaimrc.c	Thu Feb 20 01:36:50 2003 +0000
+++ b/src/gaimrc.c	Thu Feb 20 05:00:27 2003 +0000
@@ -801,8 +801,10 @@
 
 	/* this is where we do bugs and compatibility stuff */
 	if (!(sound_options & (OPT_SOUND_BEEP | OPT_SOUND_NORMAL | OPT_SOUND_ESD
-					| OPT_SOUND_ARTS | OPT_SOUND_NAS | OPT_SOUND_CMD)))
+					| OPT_SOUND_ARTS | OPT_SOUND_NAS | OPT_SOUND_CMD))) {
 		sound_options |= OPT_SOUND_NORMAL;
+		gaim_sound_change_output_method();
+	}
 
 	if (conv_size.width == 0 &&
 	    conv_size.height == 0 &&
--- 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;