From 8d8fea1106dfc80248ccf0c7a4e8ad99dc5f6d97 Mon Sep 17 00:00:00 2001 From: havoc Date: Thu, 30 Aug 2007 12:55:17 +0000 Subject: [PATCH] eliminated channel_t reference in OGG_FetchEnd git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7549 d7cf8633-e32d-0410-b094-e92efae38249 --- snd_main.c | 2 +- snd_main.h | 2 +- snd_ogg.c | 12 +++--------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/snd_main.c b/snd_main.c index e1e03a58..f5991953 100644 --- a/snd_main.c +++ b/snd_main.c @@ -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 diff --git a/snd_main.h b/snd_main.h index 51d2820d..eb4f4fb1 100644 --- a/snd_main.h +++ b/snd_main.h @@ -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 diff --git a/snd_ogg.c b/snd_ogg.c index ccedb504..b8ab271f 100644 --- 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; } -- 2.39.2