diff --git a/mkxp.json b/mkxp.json index 6518189..9ff4a29 100644 --- a/mkxp.json +++ b/mkxp.json @@ -467,16 +467,6 @@ // // "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 0), - // but other runtimes might use a different scale. - // 0: -35 dB (a gain of -0.35 dB is applied to the sound for every percent - // the volume is set below 100%) - // 1: linear (sound amplitude is multiplied by the volume) - // (default: 0) - // - // "volumeScale": 0, - // SoundFont to use for midi playback (via fluidsynth) // (default: none) // diff --git a/src/audio/al-util.h b/src/audio/al-util.h index e5ce343..3ddb869 100644 --- a/src/audio/al-util.h +++ b/src/audio/al-util.h @@ -27,7 +27,6 @@ #include #include -#include #include namespace AL @@ -168,22 +167,10 @@ namespace Source return value; } - enum VolumeScale + inline void setVolume(Source::ID id, float value) { - Db35 = 0, - Linear = 1, - }; - - inline void setVolume(Source::ID id, float value, VolumeScale scale) - { - switch (scale) { - case Linear: - break; - default: - if (value > FLT_EPSILON) { - value = std::pow(10.0f, -(35.0f / 20.0f) * (1.0f - value)); - } - break; + if (value > FLT_EPSILON) { + value = std::pow(10.0f, -(35.0f / 20.0f) * (1.0f - value)); } alSourcef(id.al, AL_GAIN, value); } diff --git a/src/audio/alstream.cpp b/src/audio/alstream.cpp index f404341..af1cc2f 100644 --- a/src/audio/alstream.cpp +++ b/src/audio/alstream.cpp @@ -36,11 +36,9 @@ #include ALStream::ALStream(LoopMode loopMode, - AL::Source::VolumeScale volumeScale, const std::string &threadId) : looped(loopMode == Looped), state(Closed), - volumeScale(volumeScale), source(0), thread(0), preemptPause(false), @@ -48,7 +46,7 @@ ALStream::ALStream(LoopMode loopMode, { alSrc = AL::Source::gen(); - AL::Source::setVolume(alSrc, 1.0f, volumeScale); + AL::Source::setVolume(alSrc, 1.0f); AL::Source::setPitch(alSrc, 1.0f); AL::Source::detachBuffer(alSrc); @@ -166,7 +164,7 @@ void ALStream::pause() void ALStream::setVolume(float value) { - AL::Source::setVolume(alSrc, value, volumeScale); + AL::Source::setVolume(alSrc, value); } void ALStream::setPitch(float value) diff --git a/src/audio/alstream.h b/src/audio/alstream.h index 0a09be0..7391c4b 100644 --- a/src/audio/alstream.h +++ b/src/audio/alstream.h @@ -47,8 +47,6 @@ struct ALStream bool looped; State state; - AL::Source::VolumeScale volumeScale; - ALDataSource *source; SDL_Thread *thread; @@ -91,7 +89,6 @@ struct ALStream }; ALStream(LoopMode loopMode, - AL::Source::VolumeScale volumeScale, const std::string &threadId); ~ALStream(); diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index fe549d0..6fec348 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -69,15 +69,15 @@ struct AudioPrivate } meWatch; AudioPrivate(RGSSThreadData &rtData) - : bgs(ALStream::Looped, static_cast(rtData.config.volumeScale), "bgs"), - me(ALStream::NotLooped, static_cast(rtData.config.volumeScale), "me"), + : bgs(ALStream::Looped, "bgs"), + me(ALStream::NotLooped, "me"), se(rtData.config), syncPoint(rtData.syncPoint), volumeRatio(1) { for (int i = 0; i < rtData.config.BGM.trackCount; i++) { std::string id = std::string("bgm" + std::to_string(i)); - bgmTracks.push_back(new AudioStream(ALStream::Looped, static_cast(rtData.config.volumeScale), id.c_str())); + bgmTracks.push_back(new AudioStream(ALStream::Looped, id.c_str())); } meWatch.state = MeNotPlaying; diff --git a/src/audio/audiostream.cpp b/src/audio/audiostream.cpp index e01e2fa..c86813d 100644 --- a/src/audio/audiostream.cpp +++ b/src/audio/audiostream.cpp @@ -29,11 +29,10 @@ #include AudioStream::AudioStream(ALStream::LoopMode loopMode, - AL::Source::VolumeScale volumeScale, const std::string &threadId) : extPaused(false), noResumeStop(false), - stream(loopMode, volumeScale, threadId) + stream(loopMode, threadId) { current.volume = 1.0f; current.pitch = 1.0f; diff --git a/src/audio/audiostream.h b/src/audio/audiostream.h index b8b359a..5f97fcc 100644 --- a/src/audio/audiostream.h +++ b/src/audio/audiostream.h @@ -121,7 +121,6 @@ struct AudioStream } fadeIn; AudioStream(ALStream::LoopMode loopMode, - AL::Source::VolumeScale volumeScale, const std::string &threadId); ~AudioStream(); diff --git a/src/audio/soundemitter.cpp b/src/audio/soundemitter.cpp index 7c43713..9808809 100644 --- a/src/audio/soundemitter.cpp +++ b/src/audio/soundemitter.cpp @@ -93,8 +93,7 @@ SoundEmitter::SoundEmitter(const Config &conf) srcCount(conf.SE.sourceCount), alSrcs(srcCount), atchBufs(srcCount), - srcPrio(srcCount), - volumeScale(static_cast(conf.volumeScale)) + srcPrio(srcCount) { for (size_t i = 0; i < srcCount; ++i) { @@ -173,7 +172,7 @@ void SoundEmitter::play(const std::string &filename, if (switchBuffer) AL::Source::attachBuffer(src, buffer->alBuffer); - AL::Source::setVolume(src, _volume, volumeScale); + AL::Source::setVolume(src, _volume); AL::Source::setPitch(src, _pitch); AL::Source::play(src); diff --git a/src/audio/soundemitter.h b/src/audio/soundemitter.h index ab0209e..0a83423 100644 --- a/src/audio/soundemitter.h +++ b/src/audio/soundemitter.h @@ -49,8 +49,6 @@ struct SoundEmitter /* Indices of sources, sorted by priority (lowest first) */ std::vector srcPrio; - AL::Source::VolumeScale volumeScale; - SoundEmitter(const Config &conf); ~SoundEmitter(); diff --git a/src/config.cpp b/src/config.cpp index a9b7b9d..6d89d8e 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -178,7 +178,6 @@ void Config::read(int argc, char *argv[]) { {"dataPathApp", ""}, {"iconPath", ""}, {"execName", "Game"}, - {"volumeScale", 0}, {"midiSoundFont", ""}, {"midiChorus", false}, {"midiReverb", false}, @@ -307,7 +306,6 @@ try { exp } catch (...) {} SET_OPT(anyAltToggleFS, boolean); SET_OPT(enableReset, boolean); SET_OPT(enableSettings, boolean); - SET_OPT(volumeScale, integer); SET_STRINGOPT(midi.soundFont, midiSoundFont); SET_OPT_CUSTOMKEY(midi.chorus, midiChorus, boolean); SET_OPT_CUSTOMKEY(midi.reverb, midiReverb, boolean); diff --git a/src/config.h b/src/config.h index e448c28..7460577 100644 --- a/src/config.h +++ b/src/config.h @@ -93,8 +93,6 @@ struct Config { std::string execName; std::string titleLanguage; - int volumeScale; - struct { std::string soundFont; bool chorus;