From 5855cd7127c9c7b40a67dd9d8aecbd065fc231b9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 22 Jun 2010 15:01:45 +0000 Subject: [PATCH] The volume subop of kDoAudio returns the previous volume in SCI2.1, but not in earlier versions svn-id: r50141 --- engines/sci/engine/ksound.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp index 46f9aa95d80..0172b005ac1 100644 --- a/engines/sci/engine/ksound.cpp +++ b/engines/sci/engine/ksound.cpp @@ -152,8 +152,15 @@ reg_t kDoAudio(EngineState *s, int argc, reg_t *argv) { int16 volume = argv[1].toUint16(); volume = CLIP(volume, 0, AUDIO_VOLUME_MAX); debugC(2, kDebugLevelSound, "kDoAudio: set volume to %d", volume); +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2_1) { + int16 volumePrev = mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) / 2; + volumePrev = CLIP(volumePrev, 0, AUDIO_VOLUME_MAX); + mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume * 2); + return make_reg(0, volumePrev); + } else +#endif mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume * 2); - return make_reg(0, volume); } case kSciAudioLanguage: // In SCI1.1: tests for digital audio support