changeset 47:ea58bc3b15d7

Added init() and quit() methods.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 22 Sep 2001 14:41:38 +0000
parents 6e13fcc178da
children c4b8c39a9798
files decoders/aiff.c decoders/ogg.c decoders/raw.c decoders/skeleton.c decoders/voc.c decoders/wav.c
diffstat 6 files changed, 115 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/decoders/aiff.c	Sat Sep 22 14:41:10 2001 +0000
+++ b/decoders/aiff.c	Sat Sep 22 14:41:38 2001 +0000
@@ -57,7 +57,8 @@
 #error SOUND_SUPPORTS_AIFF must be defined.
 #endif
 
-
+static int AIFF_init(void);
+static void AIFF_quit(void);
 static int AIFF_open(Sound_Sample *sample, const char *ext);
 static void AIFF_close(Sound_Sample *sample);
 static Uint32 AIFF_read(Sound_Sample *sample);
@@ -71,9 +72,11 @@
         "http://www.icculus.org/SDL_sound/"
     },
 
-    AIFF_open,      /* open() method       */
-    AIFF_close,     /* close() method       */
-    AIFF_read       /* read() method       */
+    AIFF_init,      /*  init() method */
+    AIFF_quit,      /*  quit() method */
+    AIFF_open,      /*  open() method */
+    AIFF_close,     /* close() method */
+    AIFF_read       /*  read() method */
 };
 
 
@@ -135,6 +138,19 @@
 } comm_t;
 
 
+
+static int AIFF_init(void)
+{
+    return(1);  /* always succeeds. */
+} /* AIFF_init */
+
+
+static void AIFF_quit(void)
+{
+    /* it's a no-op. */
+} /* AIFF_quit */
+
+
 /*
  * Sample rate is encoded as an "80 bit IEEE Standard 754 floating point
  * number (Standard Apple Numeric Environment [SANE] data type Extended)".
--- a/decoders/ogg.c	Sat Sep 22 14:41:10 2001 +0000
+++ b/decoders/ogg.c	Sat Sep 22 14:41:38 2001 +0000
@@ -49,7 +49,8 @@
 #error SOUND_SUPPORTS_OGG must be defined.
 #endif
 
-
+static int OGG_init(void);
+static void OGG_quit(void);
 static int OGG_open(Sound_Sample *sample, const char *ext);
 static void OGG_close(Sound_Sample *sample);
 static Uint32 OGG_read(Sound_Sample *sample);
@@ -63,12 +64,27 @@
         "http://www.icculus.org/SDL_sound/"
     },
 
-    OGG_open,       /* open() method       */
-    OGG_close,      /* close() method       */
-    OGG_read        /* read() method       */
+    OGG_init,       /*  init() method */
+    OGG_quit,       /*  quit() method */
+    OGG_open,       /*  open() method */
+    OGG_close,      /* close() method */
+    OGG_read        /*  read() method */
 };
 
 
+static int OGG_init(void)
+{
+    return(1);  /* always succeeds. */
+} /* OGG_init */
+
+
+static void OGG_quit(void)
+{
+    /* it's a no-op. */
+} /* OGG_quit */
+
+
+
     /*
      * These are callbacks from vorbisfile that let them read data from
      *  a RWops...
--- a/decoders/raw.c	Sat Sep 22 14:41:10 2001 +0000
+++ b/decoders/raw.c	Sat Sep 22 14:41:38 2001 +0000
@@ -52,6 +52,8 @@
 #endif
 
 
+static int RAW_init(void);
+static void RAW_quit(void);
 static int RAW_open(Sound_Sample *sample, const char *ext);
 static void RAW_close(Sound_Sample *sample);
 static Uint32 RAW_read(Sound_Sample *sample);
@@ -65,12 +67,26 @@
         "http://www.icculus.org/SDL_sound/"
     },
 
-    RAW_open,       /* open() method       */
-    RAW_close,      /* close() method       */
-    RAW_read        /* read() method       */
+    RAW_init,       /*  init() method */
+    RAW_quit,       /*  quit() method */
+    RAW_open,       /*  open() method */
+    RAW_close,      /* close() method */
+    RAW_read        /*  read() method */
 };
 
 
+static int RAW_init(void)
+{
+    return(1);  /* always succeeds. */
+} /* RAW_init */
+
+
+static void RAW_quit(void)
+{
+    /* it's a no-op. */
+} /* RAW_quit */
+
+
 static int RAW_open(Sound_Sample *sample, const char *ext)
 {
         /*
--- a/decoders/skeleton.c	Sat Sep 22 14:41:10 2001 +0000
+++ b/decoders/skeleton.c	Sat Sep 22 14:41:38 2001 +0000
@@ -43,6 +43,8 @@
 #endif
 
 
+static int FMT_init(void);
+static void FMT_quit(void);
 static int FMT_open(Sound_Sample *sample, const char *ext);
 static void FMT_close(Sound_Sample *sample);
 static Uint32 FMT_read(Sound_Sample *sample);
@@ -56,12 +58,28 @@
         "http://www.icculus.org/SDL_sound/"
     },
 
+    FMT_init,       /* init() method       */
+    FMT_quit,       /* quit() method       */
     FMT_open,       /* open() method       */
     FMT_close,      /* close() method       */
     FMT_read        /* read() method       */
 };
 
 
+static int FMT_init(void)
+{
+    /* do any global decoder/library initialization you need here. */
+
+    return(1);  /* initialization successful. */
+} /* FMT_init */
+
+
+static void FMT_quit(void)
+{
+    /* do any global decoder/library cleanup you need here. */
+} /* FMT_quit */
+
+
 static int FMT_open(Sound_Sample *sample, const char *ext)
 {
     Sound_SampleInternal *internal = (Sound_SampleInternal *) sample->opaque;
--- a/decoders/voc.c	Sat Sep 22 14:41:10 2001 +0000
+++ b/decoders/voc.c	Sat Sep 22 14:41:38 2001 +0000
@@ -51,6 +51,8 @@
 #endif
 
 
+static int VOC_init(void);
+static void VOC_quit(void);
 static int VOC_open(Sound_Sample *sample, const char *ext);
 static void VOC_close(Sound_Sample *sample);
 static Uint32 VOC_read(Sound_Sample *sample);
@@ -64,9 +66,11 @@
         "http://www.icculus.org/SDL_sound/"
     },
 
-    VOC_open,       /* open() method       */
-    VOC_close,      /* close() method       */
-    VOC_read        /* read() method       */
+    VOC_init,       /*  init() method */
+    VOC_quit,       /*  quit() method */
+    VOC_open,       /*  open() method */
+    VOC_close,      /* close() method */
+    VOC_read        /*  read() method */
 };
 
 
@@ -117,6 +121,18 @@
 #define VOC_DATA_16   9
 
 
+static int VOC_init(void)
+{
+    return(1);  /* always succeeds. */
+} /* VOC_init */
+
+
+static void VOC_quit(void)
+{
+    /* it's a no-op. */
+} /* VOC_quit */
+
+
 static __inline__ int voc_check_header(SDL_RWops *src)
 {
     /* VOC magic header */
--- a/decoders/wav.c	Sat Sep 22 14:41:10 2001 +0000
+++ b/decoders/wav.c	Sat Sep 22 14:41:38 2001 +0000
@@ -41,6 +41,8 @@
 #error SOUND_SUPPORTS_WAV must be defined.
 #endif
 
+static int WAV_init(void);
+static void WAV_quit(void);
 static int WAV_open(Sound_Sample *sample, const char *ext);
 static void WAV_close(Sound_Sample *sample);
 static Uint32 WAV_read(Sound_Sample *sample);
@@ -54,9 +56,11 @@
         "http://www.icculus.org/SDL_sound/"
     },
 
-    WAV_open,       /* open() method       */
-    WAV_close,      /* close() method       */
-    WAV_read        /* read() method       */
+    WAV_init,       /*  init() method */
+    WAV_quit,       /*  quit() method */
+    WAV_open,       /*  open() method */
+    WAV_close,      /* close() method */
+    WAV_read        /*  read() method */
 };
 
 
@@ -90,6 +94,18 @@
 } fmt_t;
 
 
+static int WAV_init(void)
+{
+    return(1);  /* always succeeds. */
+} /* WAV_init */
+
+
+static void WAV_quit(void)
+{
+    /* it's a no-op. */
+} /* WAV_quit */
+
+
 /*
  * Read in a fmt_t from disk. This makes this process safe regardless of
  *  the processor's byte order or how the fmt_t structure is packed.