changeset 62:4a352dd2a91c trunk

[svn] - be a little smarter about this
author nenolod
date Sat, 30 Sep 2006 21:40:46 -0700
parents a69b14abbc65
children 023b3e4147c0
files ChangeLog src/CoreAudio/audio.c
diffstat 2 files changed, 44 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Sep 30 21:33:57 2006 -0700
+++ b/ChangeLog	Sat Sep 30 21:40:46 2006 -0700
@@ -1,3 +1,11 @@
+2006-10-01 04:33:57 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [122]
+  - conversion tables
+  
+  trunk/src/CoreAudio/audio.c |   32 +++++++++++++++++++++++++++++---
+  1 file changed, 29 insertions(+), 3 deletions(-)
+
+
 2006-10-01 04:30:12 +0000  William Pitcock <nenolod@nenolod.net>
   revision [120]
   - use xconvert to swap endianness if necessary (LE -> BE, vice versa)
--- a/src/CoreAudio/audio.c	Sat Sep 30 21:33:57 2006 -0700
+++ b/src/CoreAudio/audio.c	Sat Sep 30 21:40:46 2006 -0700
@@ -93,8 +93,37 @@
 	return bitrate;
 }
 
+static int osx_get_format(AFormat fmt)
+{
+	int format = 0;
 
-static int osx_get_format(AFormat fmt)
+	switch (fmt)
+	{
+		case FMT_U16_NE:
+#ifdef WORDS_BIGENDIAN
+			format = FMT_U16_BE;
+#else
+			format = FMT_U16_LE;
+#endif
+			break;
+		case FMT_S16_NE:
+#ifdef WORDS_BIGENDIAN
+			format = FMT_S16_BE;
+#else
+			format = FMT_S16_LE;
+#endif
+			break;
+		default:
+			format = fmt;
+			break;
+	}
+
+	printf("in: %d, out: %d\n", fmt, format);
+
+	return format;
+}
+
+static int osx_get_conv_format(AFormat fmt)
 {
 	int format = 0;
 
@@ -147,6 +176,8 @@
 			break;
 	}
 
+	printf("in: %d, out: %d\n", fmt, format);
+
 	return format;
 }
 
@@ -255,7 +286,10 @@
 
 	osx_set_audio_params();
 
-        osx_convert_func = osx_get_convert_func(fmt, output.format.osx);
+        if (fmt != osx_get_conv_format(fmt))
+	        osx_convert_func = osx_get_convert_func(fmt, osx_get_conv_format(fmt));
+	else
+		osx_convert_func = NULL;
 
 	output.bps = osx_calc_bitrate(output.format.osx, output.frequency,output.channels);
 }