// Free it
if (sfx->fetcher != NULL && sfx->fetcher->free != NULL)
- sfx->fetcher->free (sfx);
+ sfx->fetcher->free (sfx->fetcher_data);
Mem_Free (sfx);
}
{
snd_fetcher_endsb_t fetcher_endsb = sfx->fetcher->endsb;
if (fetcher_endsb != NULL)
- fetcher_endsb (&ch->fetcher_data);
+ fetcher_endsb (ch->fetcher_data);
}
// Remove the lock it holds
S_UnlockSfx (sfx);
+ ch->fetcher_data = NULL;
ch->sfx = NULL;
}
}
// 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) (void **chfetcherpointer);
-typedef void (*snd_fetcher_free_t) (sfx_t* sfx);
+typedef void (*snd_fetcher_endsb_t) (void *chfetcherdata);
+typedef void (*snd_fetcher_free_t) (void *sfxfetcherdata);
typedef const snd_format_t* (*snd_fetcher_getfmt_t) (sfx_t* sfx);
struct snd_fetcher_s
{
OGG_FetchEnd
====================
*/
-static void OGG_FetchEnd (void **chfetcherpointer)
+static void OGG_FetchEnd (void *chfetcherdata)
{
- ogg_stream_perchannel_t* per_ch = (ogg_stream_perchannel_t *)*chfetcherpointer;
+ ogg_stream_perchannel_t* per_ch = (ogg_stream_perchannel_t *)chfetcherdata;
if (per_ch != NULL)
{
Mem_Free (per_ch);
}
- *chfetcherpointer = NULL;
}
OGG_FreeSfx
====================
*/
-static void OGG_FreeSfx (sfx_t* sfx)
+static void OGG_FreeSfx (void *sfxfetcherdata)
{
- ogg_stream_persfx_t* per_sfx = (ogg_stream_persfx_t *)sfx->fetcher_data;
+ ogg_stream_persfx_t* per_sfx = (ogg_stream_persfx_t *)sfxfetcherdata;
// Free the Ogg Vorbis file
Mem_Free(per_sfx->file);
- sfx->memsize -= per_sfx->filesize;
// Free the stream structure
Mem_Free(per_sfx);
- sfx->memsize -= sizeof (*per_sfx);
-
- sfx->fetcher_data = NULL;
- sfx->fetcher = NULL;
}
WAV_FreeSfx
====================
*/
-static void WAV_FreeSfx (sfx_t* sfx)
+static void WAV_FreeSfx (void *sfxfetcherdata)
{
- snd_buffer_t* sb = (snd_buffer_t *)sfx->fetcher_data;
-
+ snd_buffer_t* sb = (snd_buffer_t *)sfxfetcherdata;
// Free the sound buffer
- sfx->memsize -= (sb->maxframes * sb->format.channels * sb->format.width) + sizeof (*sb) - sizeof (sb->samples);
Mem_Free(sb);
-
- sfx->fetcher_data = NULL;
- sfx->fetcher = NULL;
}
/*