comparison SDL_sound.c @ 26:ddc3614c9042

Bugfix (thanks Tsuyoshi Iguchi!), and Ogg Vorbis decoder entry.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 19 Sep 2001 14:33:06 +0000
parents d4ac6ce1360e
children f27bcbcaeab1
comparison
equal deleted inserted replaced
25:4acb5260d684 26:ddc3614c9042
50 50
51 #if (defined SOUND_SUPPORTS_WAV) 51 #if (defined SOUND_SUPPORTS_WAV)
52 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV; 52 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_WAV;
53 #endif 53 #endif
54 54
55 #if (defined SOUND_SUPPORTS_OGG)
56 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_OGG;
57 #endif
58
55 #if (defined SOUND_SUPPORTS_VOC) 59 #if (defined SOUND_SUPPORTS_VOC)
56 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_VOC; 60 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_VOC;
57 #endif 61 #endif
58 62
59 #if (defined SOUND_SUPPORTS_RAW) 63 #if (defined SOUND_SUPPORTS_RAW)
66 &__Sound_DecoderFunctions_MP3, 70 &__Sound_DecoderFunctions_MP3,
67 #endif 71 #endif
68 72
69 #if (defined SOUND_SUPPORTS_WAV) 73 #if (defined SOUND_SUPPORTS_WAV)
70 &__Sound_DecoderFunctions_WAV, 74 &__Sound_DecoderFunctions_WAV,
75 #endif
76
77 #if (defined SOUND_SUPPORTS_OGG)
78 &__Sound_DecoderFunctions_OGG,
71 #endif 79 #endif
72 80
73 #if (defined SOUND_SUPPORTS_VOC) 81 #if (defined SOUND_SUPPORTS_VOC)
74 &__Sound_DecoderFunctions_VOC, 82 &__Sound_DecoderFunctions_VOC,
75 #endif 83 #endif
112 SDL_Init(SDL_INIT_AUDIO); 120 SDL_Init(SDL_INIT_AUDIO);
113 121
114 for (i = 0; decoderFuncs[i] != NULL; i++) 122 for (i = 0; decoderFuncs[i] != NULL; i++)
115 ; /* do nothing. */ 123 ; /* do nothing. */
116 124
117 i++;
118 available_decoders = (const Sound_DecoderInfo **) 125 available_decoders = (const Sound_DecoderInfo **)
119 malloc(i * sizeof (Sound_DecoderInfo *)); 126 malloc((i + 1) * sizeof (Sound_DecoderInfo *));
120 BAIL_IF_MACRO(available_decoders == NULL, ERR_OUT_OF_MEMORY, 0); 127 BAIL_IF_MACRO(available_decoders == NULL, ERR_OUT_OF_MEMORY, 0);
121 128
122 for (i = 0; decoderFuncs[i] != NULL; i++) 129 for (i = 0; decoderFuncs[i] != NULL; i++)
123 available_decoders[i] = &decoderFuncs[i]->info; 130 available_decoders[i] = &decoderFuncs[i]->info;
131
132 available_decoders[i] = NULL;
124 133
125 initialized = 1; 134 initialized = 1;
126 return(1); 135 return(1);
127 } /* Sound_Init */ 136 } /* Sound_Init */
128 137