diff options
-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() { |