mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-17 19:11:30 +00:00
s_sound.c: consolidate music volume related functions, always use cvars internally
This commit is contained in:
parent
472f7d060c
commit
acbe0b270c
4 changed files with 20 additions and 27 deletions
|
|
@ -1659,8 +1659,8 @@ void D_SRB2Main(void)
|
|||
CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n");
|
||||
I_StartupSound();
|
||||
I_InitMusic();
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
S_InitMusicVolume();
|
||||
S_InitSfxChannels();
|
||||
S_SetMusicVolume();
|
||||
}
|
||||
|
||||
Music_Init();
|
||||
|
|
|
|||
|
|
@ -667,9 +667,9 @@ void S_UpdateSounds(void)
|
|||
|
||||
// Update sound/music volumes, if changed manually at console
|
||||
if (actualsfxvolume != cv_soundvolume.value)
|
||||
S_SetSfxVolume (cv_soundvolume.value);
|
||||
S_SetSfxVolume();
|
||||
if (actualdigmusicvolume != cv_digmusicvolume.value)
|
||||
S_SetDigMusicVolume (cv_digmusicvolume.value);
|
||||
S_SetMusicVolume();
|
||||
|
||||
// We're done now, if we're not in a level.
|
||||
if (gamestate != GS_LEVEL)
|
||||
|
|
@ -852,13 +852,12 @@ void S_UpdateClosedCaptions(void)
|
|||
}
|
||||
}
|
||||
|
||||
void S_SetSfxVolume(INT32 volume)
|
||||
void S_SetSfxVolume(void)
|
||||
{
|
||||
//CV_SetValue(&cv_soundvolume, volume);
|
||||
actualsfxvolume = volume;
|
||||
actualsfxvolume = cv_soundvolume.value;
|
||||
|
||||
// now hardware volume
|
||||
I_SetSfxVolume(volume);
|
||||
I_SetSfxVolume(actualsfxvolume);
|
||||
}
|
||||
|
||||
void S_ClearSfx(void)
|
||||
|
|
@ -1149,7 +1148,7 @@ void S_StartSoundName(void *mo, const char *soundname)
|
|||
// Sets channels, SFX volume,
|
||||
// allocates channel buffer, sets S_sfx lookup.
|
||||
//
|
||||
void S_InitSfxChannels(INT32 sfxVolume)
|
||||
void S_InitSfxChannels(void)
|
||||
{
|
||||
extern consvar_t precachesound;
|
||||
|
||||
|
|
@ -1158,7 +1157,7 @@ void S_InitSfxChannels(INT32 sfxVolume)
|
|||
if (dedicated)
|
||||
return;
|
||||
|
||||
S_SetSfxVolume(sfxVolume);
|
||||
S_SetSfxVolume();
|
||||
|
||||
SetChannelsNum();
|
||||
|
||||
|
|
@ -2010,14 +2009,10 @@ void S_ResumeAudio(void)
|
|||
Music_UnPauseAll();
|
||||
}
|
||||
|
||||
void S_SetMusicVolume(INT32 digvolume)
|
||||
void S_SetMusicVolume(void)
|
||||
{
|
||||
if (digvolume < 0)
|
||||
digvolume = cv_digmusicvolume.value;
|
||||
|
||||
//CV_SetValue(&cv_digmusicvolume, digvolume);
|
||||
actualdigmusicvolume = digvolume;
|
||||
I_SetMusicVolume(digvolume);
|
||||
actualdigmusicvolume = cv_digmusicvolume.value;
|
||||
I_SetMusicVolume(actualdigmusicvolume);
|
||||
}
|
||||
|
||||
/// ------------------------
|
||||
|
|
@ -2138,8 +2133,8 @@ static void Command_RestartAudio_f(void)
|
|||
|
||||
// These must be called or no sound and music until manually set.
|
||||
|
||||
I_SetSfxVolume(cv_soundvolume.value);
|
||||
S_SetMusicVolume(cv_digmusicvolume.value);
|
||||
S_SetSfxVolume();
|
||||
S_SetMusicVolume();
|
||||
|
||||
S_StartSound(NULL, sfx_strpst);
|
||||
|
||||
|
|
@ -2311,7 +2306,7 @@ void GameSounds_OnChange(void)
|
|||
{
|
||||
sound_disabled = false;
|
||||
I_StartupSound(); // will return early if initialised
|
||||
S_InitSfxChannels(cv_soundvolume.value);
|
||||
S_InitSfxChannels();
|
||||
S_StartSound(NULL, sfx_strpst);
|
||||
}
|
||||
else
|
||||
|
|
@ -2350,7 +2345,7 @@ void PlayMusicIfUnfocused_OnChange(void)
|
|||
if (cv_playmusicifunfocused.value)
|
||||
I_SetMusicVolume(0);
|
||||
else
|
||||
S_InitMusicVolume();
|
||||
S_SetMusicVolume();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void S_RegisterSoundStuff(void);
|
|||
// Initializes sound stuff, including volume
|
||||
// Sets channels, SFX, allocates channel buffer, sets S_sfx lookup.
|
||||
//
|
||||
void S_InitSfxChannels(INT32 sfxVolume);
|
||||
void S_InitSfxChannels(void);
|
||||
|
||||
//
|
||||
// Per level startup code.
|
||||
|
|
@ -237,10 +237,8 @@ FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1,
|
|||
|
||||
INT32 S_GetSoundVolume(sfxinfo_t *sfx, INT32 volume);
|
||||
|
||||
void S_SetSfxVolume(INT32 volume);
|
||||
void S_SetMusicVolume(INT32 digvolume);
|
||||
#define S_SetDigMusicVolume S_SetMusicVolume
|
||||
#define S_InitMusicVolume() S_SetMusicVolume(-1)
|
||||
void S_SetSfxVolume(void);
|
||||
void S_SetMusicVolume(void);
|
||||
|
||||
INT32 S_OriginPlaying(void *origin);
|
||||
INT32 S_IdPlaying(sfxenum_t id);
|
||||
|
|
|
|||
|
|
@ -513,7 +513,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
|||
// Tell game we got focus back, resume music if necessary
|
||||
window_notinfocus = false;
|
||||
|
||||
S_InitMusicVolume();
|
||||
S_SetMusicVolume();
|
||||
|
||||
if (!firsttimeonmouse)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue