diff SDL_sound.c @ 37:f27bcbcaeab1

Added AIFF entry, and (for now) some multiple-streams-in-one-rwops support.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 20 Sep 2001 07:56:24 +0000
parents ddc3614c9042
children c4b8c39a9798
line wrap: on
line diff
--- a/SDL_sound.c	Thu Sep 20 07:54:47 2001 +0000
+++ b/SDL_sound.c	Thu Sep 20 07:56:24 2001 +0000
@@ -52,6 +52,10 @@
 extern const Sound_DecoderFunctions  __Sound_DecoderFunctions_WAV;
 #endif
 
+#if (defined SOUND_SUPPORTS_AIFF)
+extern const Sound_DecoderFunctions  __Sound_DecoderFunctions_AIFF;
+#endif
+
 #if (defined SOUND_SUPPORTS_OGG)
 extern const Sound_DecoderFunctions  __Sound_DecoderFunctions_OGG;
 #endif
@@ -74,6 +78,10 @@
     &__Sound_DecoderFunctions_WAV,
 #endif
 
+#if (defined SOUND_SUPPORTS_AIFF)
+    &__Sound_DecoderFunctions_AIFF,
+#endif
+
 #if (defined SOUND_SUPPORTS_OGG)
     &__Sound_DecoderFunctions_OGG,
 #endif
@@ -293,8 +301,8 @@
                         Sound_AudioInfo *_desired)
 {
     Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
+    Sound_AudioInfo desired;
     int pos = SDL_RWtell(internal->rw);  /* !!! FIXME: Int? Really? */
-    Sound_AudioInfo desired;
 
         /* fill in the funcs for this decoder... */
     sample->decoder = &funcs->info;
@@ -355,6 +363,10 @@
     } /* if */
     samplesList = sample;
 
+#if (defined MULTIPLE_STREAMS_PER_RWOPS)
+    internal->pos = SDL_RWtell(internal->rw);
+#endif
+
     _D(("New sample DESIRED format: %s format, %d rate, %d channels.\n",
         fmt_to_str(sample->desired.format),
         sample->desired.rate,
@@ -532,7 +544,20 @@
         /* reset EAGAIN. Decoder can flip it back on if it needs to. */
     sample->flags &= !SOUND_SAMPLEFLAG_EAGAIN;
 
+#if (defined MULTIPLE_STREAMS_PER_RWOPS)
+    if (SDL_RWseek(internal->rw, internal->pos, SEEK_SET) == -1)
+    {
+        sample->flags |= SOUND_SAMPLEFLAG_ERROR;
+        return(0);
+    } /* if */
+#endif
+
     retval = internal->funcs->read(sample);
+
+#if (defined MULTIPLE_STREAMS_PER_RWOPS)
+    internal->pos = SDL_RWtell(internal->rw);
+#endif
+
     if (internal->sdlcvt.needed)
     {
         internal->sdlcvt.len = retval;