diff options
author | Colin Snover | 2017-08-25 23:22:02 -0500 |
---|---|---|
committer | Colin Snover | 2017-08-26 18:09:46 -0500 |
commit | 74738489ecb19ee104189a378998372b4c6e0535 (patch) | |
tree | 4e05f0ab30842c39150301a96c638ca93b873488 | |
parent | 72b033ca2d0afe2d713934b7d3985003ec733f4b (diff) | |
download | scummvm-rg350-74738489ecb19ee104189a378998372b4c6e0535.tar.gz scummvm-rg350-74738489ecb19ee104189a378998372b4c6e0535.tar.bz2 scummvm-rg350-74738489ecb19ee104189a378998372b4c6e0535.zip |
SCI32: Fix SFX volume being misapplied to music & speech in some games
This was happening in games with game scripts that control the
master volume themselves by applying the master volume to each
channel sent to the kernel, instead of relying on the kernel to
manage the master volume for them.
-rw-r--r-- | engines/sci/engine/features.h | 11 | ||||
-rw-r--r-- | engines/sci/sound/audio32.cpp | 16 |
2 files changed, 23 insertions, 4 deletions
diff --git a/engines/sci/engine/features.h b/engines/sci/engine/features.h index 41a4b6014b..92cc45a162 100644 --- a/engines/sci/engine/features.h +++ b/engines/sci/engine/features.h @@ -110,6 +110,17 @@ public: } } + inline bool gameScriptsControlMasterVolume() const { + switch (g_sci->getGameId()) { + case GID_LSL7: + case GID_PHANTASMAGORIA2: + case GID_TORIN: + return true; + default: + return false; + } + } + inline bool hasSci3Audio() const { return getSciVersion() == SCI_VERSION_3 || g_sci->getGameId() == GID_GK2; } diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp index 7622305adb..c3f9eb4098 100644 --- a/engines/sci/sound/audio32.cpp +++ b/engines/sci/sound/audio32.cpp @@ -181,10 +181,18 @@ Audio32::Audio32(ResourceManager *resMan) : } _useModifiedAttenuation = g_sci->_features->usesModifiedAudioAttenuation(); - // The mixer stream type is given as `kSFXSoundType` so that audio from - // Audio32 will be mixed at the same standard volume as the video players - // (which must use `kSFXSoundType` as well). - _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); + + // In games where scripts premultiply master audio volumes into the volumes + // of the individual audio channels sent to the mixer, Audio32 needs to use + // the kPlainSoundType so that the master SFX volume is not applied twice. + // Otherwise, we simply pass along master volume changes to the ScummVM + // mixer for the kSFXSoundType and allow it to control master volume. + // (The volume of the kSFXSoundType in the mixer still needs to be updated + // for games that control master volumes themselves so that videos will play + // at the same volume as the rest of the game.) + const Audio::Mixer::SoundType soundType = g_sci->_features->gameScriptsControlMasterVolume() ? Audio::Mixer::kPlainSoundType : Audio::Mixer::kSFXSoundType; + + _mixer->playStream(soundType, &_handle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); } Audio32::~Audio32() { |