[Scummvm-git-logs] scummvm master -> 201219b694caf3d743ad12454e86c54159517946

AndywinXp noreply at scummvm.org
Thu Dec 1 23:57:50 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
201219b694 SCUMM: GUI: Implement internal speaker sound muting from keyboard combination


Commit: 201219b694caf3d743ad12454e86c54159517946
    https://github.com/scummvm/scummvm/commit/201219b694caf3d743ad12454e86c54159517946
Author: AndywinXp (andywinxp at gmail.com)
Date: 2022-12-02T00:57:43+01:00

Commit Message:
SCUMM: GUI: Implement internal speaker sound muting from keyboard combination

The older titles (v0-v4) allowed this. This only targets internal speaker-like audio devices,
so AdLib and MT-32 are not impacted by this, just like on the original.

Changed paths:
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index c5a2cb51a7e..a04c462d955 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -3022,6 +3022,34 @@ void ScummEngine::scummLoop_handleEffects() {
 }
 
 void ScummEngine::scummLoop_handleSound() {
+	// The original interpreters for the earlier games (v0-v4) allowed the user
+	// to disable internal speaker sounds with a keyboard combination.
+	// Let's see if sound has to be played: if we're not using the original GUI,
+	// let's allow it unconditionally; if the sound device is not between the ones listed,
+	// we allow the sound, otherwise we let our keyboard combination flag decide.
+	if (_game.version < 5 && isUsingOriginalGUI()) {
+		bool soundIsEnabled = !((_sound->_musicType == MDT_PCSPK ||
+								_sound->_musicType == MDT_PCJR ||
+								_sound->_musicType == MDT_CMS ||
+								_sound->_musicType == MDT_APPLEIIGS ||
+								_sound->_musicType == MDT_C64) &&
+								(_internalSpeakerSoundsAreOn == 0));
+
+		// Furthermore, the original ones apparently did the trick at a lower level. In our case
+		// this a bit overkill for a feature which is not that known: we could just mute the
+		// mixer to obtain the same effect. Let's avoid muting/unmuting the mixer at every
+		// scummLoop_handleSound() call, though :-)
+		if (!soundIsEnabled && !_mixerMutedByGUI) {
+			_mixer->muteSoundType(Audio::Mixer::SoundType::kMusicSoundType, true);
+			_mixer->muteSoundType(Audio::Mixer::SoundType::kPlainSoundType, true);
+			_mixerMutedByGUI = true;
+		} else if (soundIsEnabled && _mixerMutedByGUI) {
+			_mixer->muteSoundType(Audio::Mixer::SoundType::kMusicSoundType, false);
+			_mixer->muteSoundType(Audio::Mixer::SoundType::kPlainSoundType, false);
+			_mixerMutedByGUI = false;
+		}
+	}
+
 	_sound->processSound();
 }
 
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 90d90458cde..0f75920eaaf 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -659,6 +659,8 @@ protected:
 	int _guiMouseFlag = 1;
 	int _guiJoystickFlag = 1;
 
+	bool _mixerMutedByGUI = false;
+
 	Graphics::Surface _savegameThumbnail;
 	byte *_tempTextSurface = nullptr;
 	byte *_tempMainSurface = nullptr;




More information about the Scummvm-git-logs mailing list