Make the dB scale option 0 instead of the linear scale

This commit is contained in:
刘皓 2024-08-06 16:05:11 -04:00
parent a7c59b13c6
commit 6082a88511
No known key found for this signature in database
GPG key ID: 7901753DB465B711
3 changed files with 11 additions and 11 deletions

View file

@ -468,14 +468,14 @@
// "YJITEnable": false,
// Determines how the volume value of a sound affects how loud the sound is.
// The stock RPG Maker runtimes use a 35 dB scale for volume (option 1),
// The stock RPG Maker runtimes use a 35 dB scale for volume (option 0),
// but other runtimes might use a different scale.
// 0: linear (sound amplitude is multiplied by the volume)
// 1: 35 dB (a gain of -0.35 dB is applied to the sound for every percent
// 0: 35 dB (a gain of -0.35 dB is applied to the sound for every percent
// the volume is set below 100%)
// (default: 1)
// 1: linear (sound amplitude is multiplied by the volume)
// (default: 0)
//
// "volumeScale": 1,
// "volumeScale": 0,
// SoundFont to use for midi playback (via fluidsynth)
// (default: none)

View file

@ -170,20 +170,20 @@ namespace Source
enum VolumeScale
{
Linear = 0,
Db35 = 1,
Db35 = 0,
Linear = 1,
};
inline void setVolume(Source::ID id, float value, VolumeScale scale)
{
switch (scale) {
case VolumeScale::Db35:
case Linear:
break;
default:
if (value > FLT_EPSILON) {
value = std::powf(10.0f, -(35.0f / 20.0f) * (1.0f - value));
}
break;
default:
break;
}
alSourcef(id.al, AL_GAIN, value * 0.8f);
}

View file

@ -178,7 +178,7 @@ void Config::read(int argc, char *argv[]) {
{"dataPathApp", ""},
{"iconPath", ""},
{"execName", "Game"},
{"volumeScale", 1},
{"volumeScale", 0},
{"midiSoundFont", ""},
{"midiChorus", false},
{"midiReverb", false},