sfx = S_PrecacheSound (va ("cdtracks/track%02u.wav", track), false);
if (sfx != NULL)
{
- faketrack = S_StartSound (-1, 0, sfx, vec3_origin, 1, 0);
+ faketrack = S_StartSound (-1, 0, sfx, vec3_origin, cdvolume, 0);
if (faketrack != -1)
{
if (looping)
void CDAudio_Resume (void)
{
- if (!enabled || !wasPlaying)
+ if (!enabled || cdPlaying || !wasPlaying)
return;
if (faketrack != -1)
}
}
-void CDAudio_Update (void)
+void CDAudio_SetVolume (float newvol)
{
- if (!enabled)
+ // If the volume hasn't changed
+ if (newvol == cdvolume)
return;
- if (bgmvolume.value != cdvolume)
+ // If the CD has been muted
+ if (newvol == 0.0f)
+ CDAudio_Pause ();
+ else
{
- if (cdvolume)
- {
- Cvar_SetValueQuick (&bgmvolume, 0.0);
- cdvolume = bgmvolume.value;
- CDAudio_Pause ();
- }
+ // If the CD has been unmuted
+ if (cdvolume == 0.0f)
+ CDAudio_Resume ();
+
+ if (faketrack != -1)
+ S_SetChannelVolume (faketrack, newvol);
else
{
- Cvar_SetValueQuick (&bgmvolume, 1.0);
- cdvolume = bgmvolume.value;
- CDAudio_Resume ();
+ // TODO: add support for the "real CD" mixer
}
}
+ cdvolume = newvol;
+}
+
+void CDAudio_Update (void)
+{
+ if (!enabled)
+ return;
+
+ CDAudio_SetVolume (bgmvolume.value);
+
if (faketrack == -1)
CDAudio_SysUpdate();
}
else if (options_cursor == optnum++)
Cvar_SetValueQuick (&slowmo, bound(0, slowmo.value + dir * 0.25, 5));
else if (options_cursor == optnum++)
-#ifdef _WIN32
- Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 1.0, 1));
-#else
Cvar_SetValueQuick (&bgmvolume, bound(0, bgmvolume.value + dir * 0.1, 1));
-#endif
else if (options_cursor == optnum++)
Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1));
else if (options_cursor == optnum++)
}
}
+void S_SetChannelVolume (unsigned int ch_ind, float fvol)
+{
+ channels[ch_ind].master_vol = fvol * 255;
+}
+
+
void S_ClearBuffer(void)
{
int clear;
{
}
+void S_SetChannelVolume (unsigned int ch_ind, float fvol)
+{
+}
+
sfx_t *S_GetCached(const char *name)
{
return NULL;
void S_StopAllSounds(qboolean clear);
void S_PauseGameSounds (void);
void S_ResumeGameSounds (void);
+void S_SetChannelVolume (unsigned int ch_ind, float fvol);
void S_ClearBuffer (void);
void S_Update(vec3_t origin, vec3_t forward, vec3_t left, vec3_t up);
void S_ExtraUpdate (void);
extern vec3_t listener_viewleft;
extern vec3_t listener_viewup;
extern volatile dma_t *shm;
-extern volatile dma_t sn;
extern vec_t sound_nominal_clip_dist;
-extern cvar_t loadas8bit;
extern cvar_t bgmvolume;
extern cvar_t volume;
extern cvar_t snd_swapstereo;