# HG changeset patch # User Eric Wing # Date 1340091632 25200 # Node ID 5c9eaf0cc3859ff49a07f94814790948420c7782 # Parent 20a687a4d4e05b4fb9849e3760870b35a51a09f3 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. diff -r 20a687a4d4e0 -r 5c9eaf0cc385 Isolated/SoundDecoder.c --- 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 } };