comparison Isolated/SoundDecoder.c @ 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 71b465ff0622
children be97ae4f30c0
comparison
equal deleted inserted replaced
65:20a687a4d4e0 66:5c9eaf0cc385
25 static signed char s_isInitialized = 0; 25 static signed char s_isInitialized = 0;
26 static TErrorPool* s_errorPool = NULL; 26 static TErrorPool* s_errorPool = NULL;
27 27
28 static const SoundDecoder_DecoderInfo** s_availableDecoders = NULL; 28 static const SoundDecoder_DecoderInfo** s_availableDecoders = NULL;
29 29
30 #ifdef __APPLE__ 30 #ifdef __APPLE__ /* I'm making Apple use the Core Audio backend. */
31 //extern const SoundDecoder_DecoderFunctions __SoundDecoder_DecoderFunctions_CoreAudio; 31 //extern const SoundDecoder_DecoderFunctions __SoundDecoder_DecoderFunctions_CoreAudio;
32 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_CoreAudio; 32 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_CoreAudio;
33 #else /* Not Apple */
34 #ifdef SOUND_SUPPORTS_WAV
35 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
36 #endif
37 #ifdef SOUND_SUPPORTS_MPG123
38 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MPG123;
39 #endif
33 #endif 40 #endif
34 #ifdef ANDROID_NDK 41
35 #ifdef SOUND_SUPPORTS_WAV 42 /* Note: Make sure to compile only Vorbis xor Tremor, not both. */
36 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
37 #endif
38 #ifdef SOUND_SUPPORTS_MPG123
39 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MPG123;
40 #endif
41 #ifdef SOUND_SUPPORTS_OGG 43 #ifdef SOUND_SUPPORTS_OGG
42 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_OGG; 44 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_OGG;
43 #endif
44 #endif 45 #endif
45 46
46 typedef struct 47 typedef struct
47 { 48 {
48 int available; 49 int available;
50 } SoundElement; 51 } SoundElement;
51 52
52 static SoundElement s_linkedDecoders[] = 53 static SoundElement s_linkedDecoders[] =
53 { 54 {
54 #if defined(__APPLE__) 55 #if defined(__APPLE__)
55 { 0, &__Sound_DecoderFunctions_CoreAudio }, 56 { 0, &__Sound_DecoderFunctions_CoreAudio },
57 #else /* Not Apple */
58 #ifdef SOUND_SUPPORTS_WAV
59 { 0, &__Sound_DecoderFunctions_WAV },
60 #endif
61 #ifdef SOUND_SUPPORTS_MPG123
62 { 0, &__Sound_DecoderFunctions_MPG123 },
63 #endif
56 #endif 64 #endif
57 #if defined(ANDROID_NDK) 65 /* Note: Make sure to link only Vorbis xor Tremor, not both. */
58 #ifdef SOUND_SUPPORTS_WAV
59 { 0, &__Sound_DecoderFunctions_WAV },
60 #endif
61 #ifdef SOUND_SUPPORTS_MPG123
62 { 0, &__Sound_DecoderFunctions_MPG123 },
63 #endif
64 #ifdef SOUND_SUPPORTS_OGG 66 #ifdef SOUND_SUPPORTS_OGG
65 { 0, &__Sound_DecoderFunctions_OGG }, 67 { 0, &__Sound_DecoderFunctions_OGG },
66 #endif
67 #endif 68 #endif
68 { 0, NULL } 69 { 0, NULL }
69 }; 70 };
70 71
71 72