used the function I'd created for loading sounds :P (fixes cd_file plugin

loading)
This commit is contained in:
Bill Currie 2004-01-21 19:35:17 +00:00
parent 390ca99a92
commit e379238126

View file

@ -76,7 +76,7 @@ static qboolean mus_enabled = false;
static cvar_t *bgmvolume; static cvar_t *bgmvolume;
static channel_t *cd_channel; static channel_t *cd_channel;
static sfx_t cd_sfx; static sfx_t *cd_sfx;
/* added by Andrew, for cd_ogg */ /* added by Andrew, for cd_ogg */
static cvar_t *mus_ogglist; // contain the filename of the ogglist. static cvar_t *mus_ogglist; // contain the filename of the ogglist.
@ -87,6 +87,17 @@ static plitem_t *tracklist = NULL; // the parsed tracklist
/* end of added variables. */ /* end of added variables. */
static void
set_volume (void)
{
if (cd_channel->sfx) {
int vol = bgmvolume->value * 255;
cd_channel->master_vol = vol;
cd_channel->leftvol = cd_channel->rightvol = cd_channel->master_vol;
}
}
/* does nothing */ /* does nothing */
static void static void
I_OGGMus_CloseDoor (void) I_OGGMus_CloseDoor (void)
@ -200,20 +211,14 @@ I_OGGMus_Play (int track, qboolean looping)
memset (cd_channel, 0, sizeof (*cd_channel)); memset (cd_channel, 0, sizeof (*cd_channel));
} }
if (cd_sfx.name) cd_sfx = S_LoadSound ((char *) trackmap->data);
free ((char *) cd_sfx.name); if (cd_sfx) {
cd_sfx.name = strdup ((char *) trackmap->data); if (cd_sfx->wavinfo)
SND_Load (&cd_sfx); info = cd_sfx->wavinfo (cd_sfx);
if (cd_sfx.wavinfo) if (info)
info = cd_sfx.wavinfo (&cd_sfx); info->loopstart = 0;
if (info) cd_channel->sfx = cd_sfx->open (cd_sfx);
info->loopstart = 0; set_volume ();
cd_channel->sfx = cd_sfx.open (&cd_sfx);
if (cd_channel->sfx) {
int vol = bgmvolume->value * 255;
cd_channel->master_vol = vol;
cd_channel->leftvol = cd_channel->rightvol = cd_channel->master_vol;
} }
free (trackstring); free (trackstring);
@ -434,12 +439,7 @@ static void
Mus_VolChange (cvar_t *bgmvolume) Mus_VolChange (cvar_t *bgmvolume)
{ {
Sys_DPrintf ("Entering Mus_VolChange\n"); Sys_DPrintf ("Entering Mus_VolChange\n");
if (cd_channel->sfx) { set_volume ();
int vol = bgmvolume->value * 255;
cd_channel->master_vol = vol;
cd_channel->leftvol = cd_channel->rightvol = cd_channel->master_vol;
}
} }
static void static void