From 74738489ecb19ee104189a378998372b4c6e0535 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 25 Aug 2017 23:22:02 -0500 Subject: 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. --- engines/sci/sound/audio32.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'engines/sci/sound/audio32.cpp') 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() { -- cgit v1.2.3