comparison SDL_sound.c @ 10:cc2c32349380

Some debugging output, and MP3 and VOC entries, added.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 18 Sep 2001 10:58:03 +0000
parents 341cea3e13c6
children d4ac6ce1360e
comparison
equal deleted inserted replaced
9:2606137cf481 10:cc2c32349380
42 #include "SDL_sound_internal.h" 42 #include "SDL_sound_internal.h"
43 43
44 44
45 /* The various decoder drivers... */ 45 /* The various decoder drivers... */
46 46
47 #if (defined SOUND_SUPPORTS_MP3)
48 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_MP3;
49 #endif
50
47 #if (defined SOUND_SUPPORTS_VOC) 51 #if (defined SOUND_SUPPORTS_VOC)
48 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_VOC; 52 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_VOC;
49 #endif 53 #endif
50 54
51 #if (defined SOUND_SUPPORTS_RAW) 55 #if (defined SOUND_SUPPORTS_RAW)
52 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_RAW; 56 extern const Sound_DecoderFunctions __Sound_DecoderFunctions_RAW;
53 #endif 57 #endif
54 58
55 static const Sound_DecoderFunctions *decoderFuncs[] = 59 static const Sound_DecoderFunctions *decoderFuncs[] =
56 { 60 {
61 #if (defined SOUND_SUPPORTS_MP3)
62 &__Sound_DecoderFunctions_MP3,
63 #endif
64
57 #if (defined SOUND_SUPPORTS_VOC) 65 #if (defined SOUND_SUPPORTS_VOC)
58 &__Sound_DecoderFunctions_VOC, 66 &__Sound_DecoderFunctions_VOC,
59 #endif 67 #endif
60 68
61 #if (defined SOUND_SUPPORTS_RAW) 69 #if (defined SOUND_SUPPORTS_RAW)
150 * This is declared in the internal header. 158 * This is declared in the internal header.
151 */ 159 */
152 void Sound_SetError(const char *err) 160 void Sound_SetError(const char *err)
153 { 161 {
154 if (err != NULL) 162 if (err != NULL)
163 {
164 _D(("Sound_SetError(\"%s\");\n", err));
155 SDL_SetError(err); 165 SDL_SetError(err);
166 } /* if */
156 } /* Sound_SetError */ 167 } /* Sound_SetError */
157 168
158 169
159 /* 170 /*
160 * -ansi and -pedantic flags prevent use of strcasecmp() on Linux, and 171 * -ansi and -pedantic flags prevent use of strcasecmp() on Linux, and
226 retval->opaque = internal; 237 retval->opaque = internal;
227 return(retval); 238 return(retval);
228 } /* alloc_sample */ 239 } /* alloc_sample */
229 240
230 241
242 #if (defined DEBUG_CHATTER)
243 static __inline__ const char *fmt_to_str(Uint16 fmt)
244 {
245 switch(fmt)
246 {
247 case AUDIO_U8:
248 return("U8");
249 case AUDIO_S8:
250 return("S8");
251 case AUDIO_U16LSB:
252 return("U16LSB");
253 case AUDIO_S16LSB:
254 return("S16LSB");
255 case AUDIO_U16MSB:
256 return("U16MSB");
257 case AUDIO_S16MSB:
258 return("S16MSB");
259 } /* switch */
260
261 return("Unknown");
262 } /* fmt_to_str */
263 #endif
264
265
231 /* 266 /*
232 * The bulk of the Sound_NewSample() work is done here... 267 * The bulk of the Sound_NewSample() work is done here...
233 * Ask the specified decoder to handle the data in (rw), and if 268 * Ask the specified decoder to handle the data in (rw), and if
234 * so, construct the Sound_Sample. Otherwise, try to wind (rw)'s stream 269 * so, construct the Sound_Sample. Otherwise, try to wind (rw)'s stream
235 * back to where it was, and return false. 270 * back to where it was, and return false.
300 internal->next = samplesList; 335 internal->next = samplesList;
301 if (samplesList != NULL) 336 if (samplesList != NULL)
302 internal->prev = sample; 337 internal->prev = sample;
303 } /* if */ 338 } /* if */
304 samplesList = sample; 339 samplesList = sample;
340
341 _D(("New sample DESIRED format: %s format, %d rate, %d channels.\n",
342 fmt_to_str(sample->desired.format),
343 sample->desired.rate,
344 sample->desired.channels));
345
346 _D(("New sample ACTUAL format: %s format, %d rate, %d channels.\n",
347 fmt_to_str(sample->actual.format),
348 sample->actual.rate,
349 sample->actual.channels));
350
351 _D(("On-the-fly conversion: %s.\n",
352 internal->sdlcvt.needed ? "ENABLED" : "DISABLED"));
305 353
306 return(1); 354 return(1);
307 } /* init_sample */ 355 } /* init_sample */
308 356
309 357