[Scummvm-git-logs] scummvm master -> efb8774734094313d6ce7a924c2604645c7083fc

criezy criezy at scummvm.org
Sat Feb 11 15:45:24 CET 2017


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

Summary:
f7e5f01b85 DRASCULA: Add handling of the master volume
13dd57d34f DRASCULA: Fix sound volume synchronization
b7e87d9e09 DRASCULA: Link speech and SFX volumes
efb8774734 NEWS: Mention drascula volume handling improvements


Commit: f7e5f01b859c82a812a9a1466974ea18b4a8b204
    https://github.com/scummvm/scummvm/commit/f7e5f01b859c82a812a9a1466974ea18b4a8b204
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-02-11T14:38:34Z

Commit Message:
DRASCULA: Add handling of the master volume

Changed paths:
    engines/drascula/drascula.h
    engines/drascula/sound.cpp


diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index c879a83..e66220f 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -488,7 +488,7 @@ public:
 	void addKeyToBuffer(Common::KeyState& key);
 	void flushKeyBuffer();
 	void selectVerb(int);
-	void updateVolume(Audio::Mixer::SoundType soundType, int prevVolume);
+	int updateVolume(int prevVolume, int prevVolumeY);
 	void volumeControls();
 
 	bool saveLoadScreen();
diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp
index 62ec796..ef60bcc 100644
--- a/engines/drascula/sound.cpp
+++ b/engines/drascula/sound.cpp
@@ -34,13 +34,13 @@
 
 namespace Drascula {
 
-void DrasculaEngine::updateVolume(Audio::Mixer::SoundType soundType, int prevVolume) {
-	int vol = _mixer->getVolumeForSoundType(soundType) / 16;
-	if (_mouseY < prevVolume && vol < 15)
-		vol++;
-	if (_mouseY > prevVolume && vol > 0)
-		vol--;
-	_mixer->setVolumeForSoundType(soundType, vol * 16);
+int DrasculaEngine::updateVolume(int prevVolume, int prevVolumeY) {
+	prevVolumeY += 10;
+	if (_mouseY < prevVolumeY && prevVolume < 15)
+		prevVolume++;
+	if (_mouseY > prevVolumeY && prevVolume > 0)
+		prevVolume--;
+	return prevVolume;
 }
 
 void DrasculaEngine::volumeControls() {
@@ -53,10 +53,22 @@ void DrasculaEngine::volumeControls() {
 	setCursor(kCursorCrosshair);
 	showCursor();
 
+	// The engine has three volume controls: master, SFx/Speech and Music.
+	// ScummVM doesn't have a master volume, so we abuse the kPlainSoundType to store it.
+	// In drascula, we only use the kMusicSoundType and kSpeechSoundType to play sounds.
+	// For consistency with the ScummVM options dialog we also set the kSFXSoundType volume
+	// to the same value as the kMusicSoundType value, but we don't actually use it.
+
+	// The engines uses masterVolume, voiceVolume and musicVolume between 0 and 15.
+	// We store in the mixer:
+	//   - masterVolume * 16 in kPlainSoundType
+	//   - (masterVolume + 1) * (voiceVolume + 1) - 1 in both kSpeechSoundType and kSFXSoundType
+	//   - (masterVolume + 1) * (musicVolume + 1) - 1 in kMusicSoundType
+
 	while (!shouldQuit()) {
 		int masterVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16), 0, 15);
-		int voiceVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) / 16), 0, 15);
-		int musicVolume = CLIP((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16), 0, 15);
+		int voiceVolume = CLIP(((_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) + 1) / (masterVolume + 1) - 1), 0, 15);
+		int musicVolume = CLIP(((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 1) / (masterVolume + 1) - 1), 0, 15);
 
 		int masterVolumeY = 72 + 61 - masterVolume * 4;
 		int voiceVolumeY = 72 + 61 - voiceVolume * 4;
@@ -87,16 +99,22 @@ void DrasculaEngine::volumeControls() {
 		if (_leftMouseButton == 1) {
 			delay(100);
 			if (_mouseX > 80 && _mouseX < 121) {
-				updateVolume(Audio::Mixer::kPlainSoundType, masterVolumeY);
+				masterVolume = updateVolume(masterVolume, masterVolumeY);
+				_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, masterVolume * 16);
 			}
 
-			if (_mouseX > 136 && _mouseX < 178) {
-				updateVolume(Audio::Mixer::kSpeechSoundType, voiceVolumeY);
-			}
+			if (_mouseX > 136 && _mouseX < 178)
+				voiceVolume = updateVolume(voiceVolume, voiceVolumeY);
 
-			if (_mouseX > 192 && _mouseX < 233) {
-				updateVolume(Audio::Mixer::kMusicSoundType, musicVolumeY);
-			}
+			if (_mouseX > 192 && _mouseX < 233)
+				musicVolume = updateVolume(musicVolume, musicVolumeY);
+
+			voiceVolume = (masterVolume + 1) * (voiceVolume + 1) - 1;
+			_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, voiceVolume);
+			_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, voiceVolume);
+
+			musicVolume = (masterVolume + 1) * (musicVolume + 1) - 1;
+			_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, musicVolume);
 		}
 
 	}


Commit: 13dd57d34f76004306d6105339622592236bcba9
    https://github.com/scummvm/scummvm/commit/13dd57d34f76004306d6105339622592236bcba9
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-02-11T14:38:58Z

Commit Message:
DRASCULA: Fix sound volume synchronization

When using the original drascula dialog to change volume, this was
not saved to the ConfMan, which means the change was lost when
quitting the engine or when opening the ScummVM options dialog.

Also synchronising the _mixer volumes from ConfMan was resetting
the master volume to the maximum. Since ScummVM doesn't have a
master volume, there is no correct way to get it. But we now try to
guess one from the music and speech volumes.

Changed paths:
    engines/drascula/drascula.h
    engines/drascula/sound.cpp


diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index e66220f..5265324 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -325,6 +325,8 @@ public:
 	virtual ~DrasculaEngine();
 	virtual bool hasFeature(EngineFeature f) const;
 
+	virtual void syncSoundSettings();
+
 	Common::RandomSource *_rnd;
 	const DrasculaGameDescription *_gameDescription;
 	uint32 getFeatures() const;
diff --git a/engines/drascula/sound.cpp b/engines/drascula/sound.cpp
index ef60bcc..70916ca 100644
--- a/engines/drascula/sound.cpp
+++ b/engines/drascula/sound.cpp
@@ -34,6 +34,41 @@
 
 namespace Drascula {
 
+void DrasculaEngine::syncSoundSettings() {
+	// Sync the engine with the config manager
+
+	bool mute = false;
+	if (ConfMan.hasKey("mute"))
+		mute = ConfMan.getBool("mute");
+
+	// We need to handle the speech mute separately here. This is because the
+	// engine code should be able to rely on all speech sounds muted when the
+	// user specified subtitles only mode, which results in "speech_mute" to
+	// be set to "true". The global mute setting has precedence over the
+	// speech mute setting though.
+	bool speechMute = mute;
+	if (!speechMute)
+		speechMute = ConfMan.getBool("speech_mute");
+
+	_mixer->muteSoundType(Audio::Mixer::kPlainSoundType, mute);
+	_mixer->muteSoundType(Audio::Mixer::kSFXSoundType, mute);
+	_mixer->muteSoundType(Audio::Mixer::kSpeechSoundType, speechMute);
+	_mixer->muteSoundType(Audio::Mixer::kMusicSoundType, mute);
+
+	int voiceVolume = ConfMan.getInt("speech_volume");
+	int musicVolume = ConfMan.getInt("music_volume");
+	// If the music and voice volume are correct, don't change anything.
+	// Otherwise compute the master volume using an approximation of sqrt(max) * 16 which would result in the master
+	// volume being the same value as the max of music and voice.
+	if (_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) != voiceVolume || _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) != musicVolume) {
+		int masterVolume = MAX(musicVolume, voiceVolume) * 2 / 3 + 86;
+		_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, masterVolume);
+		_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, voiceVolume);
+		_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, voiceVolume);
+		_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, musicVolume);
+	}
+}
+
 int DrasculaEngine::updateVolume(int prevVolume, int prevVolumeY) {
 	prevVolumeY += 10;
 	if (_mouseY < prevVolumeY && prevVolume < 15)
@@ -112,9 +147,12 @@ void DrasculaEngine::volumeControls() {
 			voiceVolume = (masterVolume + 1) * (voiceVolume + 1) - 1;
 			_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, voiceVolume);
 			_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, voiceVolume);
+			ConfMan.setInt("speech_volume", voiceVolume);
+			ConfMan.setInt("sfx_volume", voiceVolume);
 
 			musicVolume = (masterVolume + 1) * (musicVolume + 1) - 1;
 			_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, musicVolume);
+			ConfMan.setInt("music_volume", musicVolume);
 		}
 
 	}


Commit: b7e87d9e094221580d2ac0967b67683f0c0bb06f
    https://github.com/scummvm/scummvm/commit/b7e87d9e094221580d2ac0967b67683f0c0bb06f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-02-11T14:38:58Z

Commit Message:
DRASCULA: Link speech and SFX volumes

Changed paths:
    engines/drascula/detection.cpp


diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp
index ceaadd5..49c7b0b 100644
--- a/engines/drascula/detection.cpp
+++ b/engines/drascula/detection.cpp
@@ -87,7 +87,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			GF_PACKED,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -104,7 +104,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::FR_FRA,
 			Common::kPlatformDOS,
 			GF_PACKED,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -121,7 +121,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::FR_FRA,
 			Common::kPlatformDOS,
 			GF_PACKED,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -138,7 +138,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::DE_DEU,
 			Common::kPlatformDOS,
 			GF_PACKED,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -151,7 +151,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::IT_ITA,
 			Common::kPlatformDOS,
 			GF_PACKED,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -168,7 +168,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::IT_ITA,
 			Common::kPlatformDOS,
 			GF_PACKED,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -181,7 +181,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::ES_ESP,
 			Common::kPlatformDOS,
 			GF_PACKED,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -198,7 +198,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::ES_ESP,
 			Common::kPlatformDOS,
 			GF_PACKED,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -213,7 +213,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::EN_ANY,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -226,7 +226,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::FR_FRA,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -239,7 +239,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::FR_FRA,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -252,7 +252,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::DE_DEU,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -265,7 +265,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::IT_ITA,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -278,7 +278,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::IT_ITA,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 
@@ -291,7 +291,7 @@ static const DrasculaGameDescription gameDescriptions[] = {
 			Common::ES_ESP,
 			Common::kPlatformDOS,
 			ADGF_NO_FLAGS,
-			GUIO0()
+			GUIO1(GUIO_LINKSPEECHTOSFX)
 		},
 	},
 


Commit: efb8774734094313d6ce7a924c2604645c7083fc
    https://github.com/scummvm/scummvm/commit/efb8774734094313d6ce7a924c2604645c7083fc
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-02-11T14:41:48Z

Commit Message:
NEWS: Mention drascula volume handling improvements

Changed paths:
    NEWS


diff --git a/NEWS b/NEWS
index c7e9678..23c6fae 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,10 @@ For a more comprehensive changelog of the latest experimental code, see:
  Composer:
    - Added save/load from General Main Menu.
 
+Drascula:
+  - Add handling of the master volume and fix volume synchronization between
+    the game and ScummVM options.
+
 1.9.1 (YYYY-MM-DD)
  General:
    - Added bilinear filtering option for SDL2 fullscreen mode.





More information about the Scummvm-git-logs mailing list