changeset 66:5c9eaf0cc385

Macro cleanups for selecting which decoders to compile in. Before this was hacked for Apple vs. Android. But now it is Apple vs. whatever to be a little more flexible. If Apple, Core Audio will always be picked for WAV/MP3. This could be more flexible, but for shipping apps, there are not a lot of compelling reasons to not use Core Audio when it is available. Ogg Vorbis/Tremor are in common areas so it is directly selectable since Core Audio does not support Ogg. You are responsible for not trying to compile/link both Vorbis/Tremor at the same time. They are mutually exclusive.
author Eric Wing <ewing . public |-at-| gmail . com>
date Tue, 19 Jun 2012 00:40:32 -0700
parents 20a687a4d4e0
children 96c61ac12446
files Isolated/SoundDecoder.c
diffstat 1 files changed, 22 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/Isolated/SoundDecoder.c	Tue Jun 19 00:33:20 2012 -0700
+++ b/Isolated/SoundDecoder.c	Tue Jun 19 00:40:32 2012 -0700
@@ -27,20 +27,21 @@
 
 static const SoundDecoder_DecoderInfo** s_availableDecoders = NULL;
 
-#ifdef __APPLE__
-//extern const SoundDecoder_DecoderFunctions __SoundDecoder_DecoderFunctions_CoreAudio;
-extern const Sound_DecoderFunctions __Sound_DecoderFunctions_CoreAudio;
+#ifdef __APPLE__ /* I'm making Apple use the Core Audio backend. */
+	//extern const SoundDecoder_DecoderFunctions __SoundDecoder_DecoderFunctions_CoreAudio;
+	extern const Sound_DecoderFunctions __Sound_DecoderFunctions_CoreAudio;
+#else /* Not Apple */
+	#ifdef SOUND_SUPPORTS_WAV
+		extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
+	#endif
+	#ifdef SOUND_SUPPORTS_MPG123
+		extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MPG123;
+	#endif
 #endif
-#ifdef ANDROID_NDK
-#ifdef SOUND_SUPPORTS_WAV
-extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
-#endif
-#ifdef SOUND_SUPPORTS_MPG123
-extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MPG123;
-#endif
+
+/* Note: Make sure to compile only Vorbis xor Tremor, not both. */
 #ifdef SOUND_SUPPORTS_OGG
-extern const Sound_DecoderFunctions __Sound_DecoderFunctions_OGG;
-#endif
+	extern const Sound_DecoderFunctions __Sound_DecoderFunctions_OGG;
 #endif
 
 typedef struct
@@ -52,19 +53,19 @@
 static SoundElement s_linkedDecoders[] =
 {
 #if defined(__APPLE__)
-    { 0, &__Sound_DecoderFunctions_CoreAudio },
+		{ 0, &__Sound_DecoderFunctions_CoreAudio },
+#else /* Not Apple */
+	#ifdef SOUND_SUPPORTS_WAV
+		{ 0, &__Sound_DecoderFunctions_WAV },
+	#endif
+	#ifdef SOUND_SUPPORTS_MPG123
+		{ 0, &__Sound_DecoderFunctions_MPG123 },
+	#endif
 #endif
-#if defined(ANDROID_NDK)
-#ifdef SOUND_SUPPORTS_WAV
-    { 0, &__Sound_DecoderFunctions_WAV },
-#endif
-#ifdef SOUND_SUPPORTS_MPG123
-    { 0, &__Sound_DecoderFunctions_MPG123 },
-#endif
+/* Note: Make sure to link only Vorbis xor Tremor, not both. */		
 #ifdef SOUND_SUPPORTS_OGG
     { 0, &__Sound_DecoderFunctions_OGG },
 #endif
-#endif
     { 0, NULL }
 };