fix the "Cache_Release: already released!" error

This commit is contained in:
Bill Currie 2007-03-23 12:33:04 +00:00 committed by Jeff Teunissen
parent 81a57bb3fa
commit 4ccb6675a6

View file

@ -44,6 +44,7 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/dstring.h" #include "QF/dstring.h"
#include "QF/model.h" #include "QF/model.h"
#include "QF/quakefs.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "snd_render.h" #include "snd_render.h"
@ -247,6 +248,13 @@ s_playvol_f (void)
dstring_delete (name); dstring_delete (name);
} }
static void
s_channels_gamedir (void)
{
ambient_sfx[AMBIENT_WATER] = SND_PrecacheSound ("ambience/water1.wav");
ambient_sfx[AMBIENT_SKY] = SND_PrecacheSound ("ambience/wind2.wav");
}
void void
SND_Channels_Init (void) SND_Channels_Init (void)
{ {
@ -279,8 +287,7 @@ SND_Channels_Init (void)
snd_num_statics = 0; snd_num_statics = 0;
ambient_sfx[AMBIENT_WATER] = SND_PrecacheSound ("ambience/water1.wav"); QFS_GamedirCallback (s_channels_gamedir);
ambient_sfx[AMBIENT_SKY] = SND_PrecacheSound ("ambience/wind2.wav");
} }
static channel_t * static channel_t *
@ -386,7 +393,6 @@ s_updateAmbientSounds (void)
sfx->retain (sfx); sfx->retain (sfx);
} else { } else {
sfx = chan->sfx; sfx = chan->sfx;
sfx->retain (sfx);//FIXME why is this needed?
} }
// sfx will be written to chan->sfx later to ensure mixer doesn't use // sfx will be written to chan->sfx later to ensure mixer doesn't use
// channel prematurely. // channel prematurely.