eliminated channel_t reference in OGG_FetchEnd
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 30 Aug 2007 12:55:17 +0000 (12:55 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 30 Aug 2007 12:55:17 +0000 (12:55 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7549 d7cf8633-e32d-0410-b094-e92efae38249

snd_main.c
snd_main.h
snd_ogg.c

index e1e03a5..f599195 100644 (file)
@@ -1248,7 +1248,7 @@ void S_StopChannel (unsigned int channel_ind)
                {
                        snd_fetcher_endsb_t fetcher_endsb = sfx->fetcher->endsb;
                        if (fetcher_endsb != NULL)
-                               fetcher_endsb (ch);
+                               fetcher_endsb (&ch->fetcher_data);
                }
 
                // Remove the lock it holds
index 51d2820..eb4f4fb 100644 (file)
@@ -97,7 +97,7 @@ typedef struct channel_s
 // Sound fetching functions
 // "start" is both an input and output parameter: it returns the actual start time of the sound buffer
 typedef const snd_buffer_t* (*snd_fetcher_getsb_t) (void *sfxfetcher, void **chfetcherpointer, unsigned int *start, unsigned int nbsampleframes);
-typedef void (*snd_fetcher_endsb_t) (channel_t* ch);
+typedef void (*snd_fetcher_endsb_t) (void **chfetcherpointer);
 typedef void (*snd_fetcher_free_t) (sfx_t* sfx);
 typedef const snd_format_t* (*snd_fetcher_getfmt_t) (sfx_t* sfx);
 struct snd_fetcher_s
index ccedb50..b8ab271 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -567,24 +567,18 @@ static const snd_buffer_t* OGG_FetchSound (void *sfxfetcher, void **chfetcherpoi
 OGG_FetchEnd
 ====================
 */
-static void OGG_FetchEnd (channel_t* ch)
+static void OGG_FetchEnd (void **chfetcherpointer)
 {
-       ogg_stream_perchannel_t* per_ch;
+       ogg_stream_perchannel_t* per_ch = (ogg_stream_perchannel_t *)*chfetcherpointer;
 
-       per_ch = (ogg_stream_perchannel_t *)ch->fetcher_data;
        if (per_ch != NULL)
        {
-               size_t buff_len;
-
                // Free the ogg vorbis decoder
                qov_clear (&per_ch->vf);
 
-               buff_len = per_ch->sb.maxframes * per_ch->sb.format.channels * per_ch->sb.format.width;
-               ch->sfx->memsize -= sizeof (*per_ch) - sizeof (per_ch->sb.samples) + buff_len;
-
                Mem_Free (per_ch);
-               ch->fetcher_data = NULL;
        }
+       *chfetcherpointer = NULL;
 }