From 610351b872a287b5b44d997e0a436f53d8d13b84 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Wed, 8 Mar 2023 15:22:29 -0600 Subject: [PATCH] Normalize all volume scales to 0-100 --- src/doomdef.h | 8 ++++---- src/s_sound.c | 12 ++++++------ src/s_sound.h | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index a3c62eeb2..a28a7085e 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -748,10 +748,10 @@ extern int /// Render flats on walls #define WALLFLATS -/// Divide volume of music and sounds by this much (loudest sounds on earth) -#define VOLUME_DIVIDER 4 -#define USER_VOLUME_SCALE 2 -#define MAX_VOLUME ( 100 * VOLUME_DIVIDER / USER_VOLUME_SCALE ) +// Volume scale is 0-100 in new mixer. 100 is treated as -0dB or 100% gain. No more weirdness to work around SDL_mixer +// problems + +#define MAX_VOLUME 100 #ifdef HAVE_CURL #define MASTERSERVER diff --git a/src/s_sound.c b/src/s_sound.c index b45215c73..ed9198755 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -72,8 +72,8 @@ consvar_t stereoreverse = CVAR_INIT ("stereoreverse", "Off", CV_SAVE, CV_OnOff, static consvar_t precachesound = CVAR_INIT ("precachesound", "Off", CV_SAVE, CV_OnOff, NULL); // actual general (maximum) sound & music volume, saved into the config -consvar_t cv_soundvolume = CVAR_INIT ("soundvolume", "50", CV_SAVE, soundvolume_cons_t, NULL); -consvar_t cv_digmusicvolume = CVAR_INIT ("musicvolume", "50", CV_SAVE, soundvolume_cons_t, NULL); +consvar_t cv_soundvolume = CVAR_INIT ("soundvolume", "80", CV_SAVE, soundvolume_cons_t, NULL); +consvar_t cv_digmusicvolume = CVAR_INIT ("musicvolume", "80", CV_SAVE, soundvolume_cons_t, NULL); // number of channels available consvar_t cv_numChannels = CVAR_INIT ("snd_channels", "64", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum); @@ -791,9 +791,9 @@ void S_UpdateSounds(void) mobj_t *listenmobj[MAXSPLITSCREENPLAYERS]; // Update sound/music volumes, if changed manually at console - if (actualsfxvolume != cv_soundvolume.value * USER_VOLUME_SCALE) + if (actualsfxvolume != cv_soundvolume.value) S_SetSfxVolume (cv_soundvolume.value); - if (actualdigmusicvolume != cv_digmusicvolume.value * USER_VOLUME_SCALE) + if (actualdigmusicvolume != cv_digmusicvolume.value) S_SetDigMusicVolume (cv_digmusicvolume.value); // We're done now, if we're not in a level. @@ -990,7 +990,7 @@ void S_UpdateClosedCaptions(void) void S_SetSfxVolume(INT32 volume) { //CV_SetValue(&cv_soundvolume, volume); - actualsfxvolume = volume * USER_VOLUME_SCALE; + actualsfxvolume = volume; #ifdef HW3SOUND hws_mode == HWS_DEFAULT_MODE ? I_SetSfxVolume(volume&0x1F) : HW3S_SetSfxVolume(volume&0x1F); @@ -2350,7 +2350,7 @@ void S_SetMusicVolume(INT32 digvolume) digvolume = cv_digmusicvolume.value; //CV_SetValue(&cv_digmusicvolume, digvolume); - actualdigmusicvolume = digvolume * USER_VOLUME_SCALE; + actualdigmusicvolume = digvolume; I_SetMusicVolume(digvolume); } diff --git a/src/s_sound.h b/src/s_sound.h index 5e29e960f..141866684 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -35,10 +35,10 @@ extern openmpt_module *openmpt_mhandle; #define PICKUP_SOUND 0x8000 // -#define SOUND_VOLUME_RANGE 256 -#define MAX_SOUND_VOLUME 255 +#define SOUND_VOLUME_RANGE 100 +#define MAX_SOUND_VOLUME 100 -#define DEFAULT_MUSICDEF_VOLUME ( 100 / VOLUME_DIVIDER ) +#define DEFAULT_MUSICDEF_VOLUME 100 extern consvar_t stereoreverse; extern consvar_t cv_soundvolume, cv_closedcaptioning, cv_digmusicvolume;