[Scummvm-cvs-logs] scummvm master -> 177409390f8e116bdc68e4c4741a92aebff5f53c

dreammaster dreammaster at scummvm.org
Sat Oct 10 22:39:03 CEST 2015


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:
177409390f SHERLOCK: SS: Fix playback of voices in cutscenes


Commit: 177409390f8e116bdc68e4c4741a92aebff5f53c
    https://github.com/scummvm/scummvm/commit/177409390f8e116bdc68e4c4741a92aebff5f53c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-10-10T16:38:28-04:00

Commit Message:
SHERLOCK: SS: Fix playback of voices in cutscenes

Changed paths:
    engines/sherlock/scalpel/scalpel_talk.cpp
    engines/sherlock/sound.cpp
    engines/sherlock/sound.h
    engines/sherlock/talk.cpp



diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp
index 375b27b..2fb2221 100644
--- a/engines/sherlock/scalpel/scalpel_talk.cpp
+++ b/engines/sherlock/scalpel/scalpel_talk.cpp
@@ -498,7 +498,7 @@ OpcodeReturn ScalpelTalk::cmdSfxCommand(const byte *&str) {
 	if (sound._voices) {
 		for (int idx = 0; idx < 8 && str[idx] != '~'; ++idx)
 			tempString += str[idx];
-		sound.playSpeech(tempString);
+		sound.playSound(tempString, WAIT_RETURN_IMMEDIATELY);
 
 		// Set voices to wait for more
 		sound._voices = 2;
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index a653db5..1d809cf 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -141,7 +141,7 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit
 		}
 	}
 
-	Audio::SoundHandle soundHandle = (IS_SERRATED_SCALPEL) ? _scalpelEffectsHandle : getFreeSoundHandle();
+	Audio::SoundHandle &soundHandle = (IS_SERRATED_SCALPEL) ? _scalpelEffectsHandle : getFreeSoundHandle();
 	if (!playSoundResource(filename, libraryFilename, Audio::Mixer::kSFXSoundType, soundHandle))
 		error("Could not find sound resource - %s", filename.c_str());
 
@@ -222,7 +222,7 @@ void Sound::freeDigiSound() {
 	_soundPlaying = false;
 }
 
-Audio::SoundHandle Sound::getFreeSoundHandle() {
+Audio::SoundHandle &Sound::getFreeSoundHandle() {
 	for (int i = 0; i < MAX_MIXER_CHANNELS; i++) {
 		if (!_mixer->isSoundHandleActive(_tattooEffectsHandle[i]))
 			return _tattooEffectsHandle[i];
@@ -238,13 +238,11 @@ void Sound::setVolume(int volume) {
 void Sound::playSpeech(const Common::String &name) {
 	Resources &res = *_vm->_res;
 	Scene &scene = *_vm->_scene;
-	stopSpeech();
-
-	// TODO: Technically Scalpel has an sfx command which I've set to call this method because it sets the
-	// _voice variable as if it were speech. Need to do a play-through of Scalpel and see if it's ever called.
-	// If so, will need to enhance this method to handle the Serrated Scalpel voice resources
 	assert(IS_ROSE_TATTOO);
 
+	// Stop any previously playing speech
+	stopSpeech();
+
 	// Figure out which speech library to use
 	Common::String libraryName = Common::String::format("speech%02d.lib", scene._currentScene);
 	if ((!scumm_strnicmp(name.c_str(), "SLVE12S", 7)) || (!scumm_strnicmp(name.c_str(), "WATS12X", 7))
@@ -264,12 +262,22 @@ void Sound::playSpeech(const Common::String &name) {
 }
 
 void Sound::stopSpeech() {
-	_mixer->stopHandle(_speechHandle);
+	if (IS_SERRATED_SCALPEL) {
+		_mixer->stopHandle(_scalpelEffectsHandle);
+	} else {
+		_mixer->stopHandle(_speechHandle);
+	}
 	_speechPlaying = false;
 }
 
 bool Sound::isSpeechPlaying() {
 	_speechPlaying = _mixer->isSoundHandleActive(_speechHandle);
+
+	if (IS_SERRATED_SCALPEL) {
+		_soundPlaying = _mixer->isSoundHandleActive(_scalpelEffectsHandle);
+		return _soundPlaying;
+	}
+
 	return _speechPlaying;
 }
 
diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h
index 44969b8..d086bcd 100644
--- a/engines/sherlock/sound.h
+++ b/engines/sherlock/sound.h
@@ -116,8 +116,14 @@ public:
 
 	void freeDigiSound();
 
-	Audio::SoundHandle getFreeSoundHandle();
+	/**
+	 * Return a sound handle to use
+	 */
+	Audio::SoundHandle &getFreeSoundHandle();
 
+	/**
+	 * Set the volume
+	 */
 	void setVolume(int volume);
 
 	/**
diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp
index b61d3f1..795c4eb 100644
--- a/engines/sherlock/talk.cpp
+++ b/engines/sherlock/talk.cpp
@@ -846,7 +846,7 @@ int Talk::waitForMore(int delay) {
 	playingSpeech = sound.isSpeechPlaying();
 
 	do {
-		if (IS_SERRATED_SCALPEL && sound._speechOn && !sound.isSpeechPlaying())
+		if (IS_SERRATED_SCALPEL && playingSpeech && !sound.isSpeechPlaying())
 			people._portrait._frameNumber = -1;
 
 		scene.doBgAnim();
@@ -890,7 +890,7 @@ int Talk::waitForMore(int delay) {
 	} while (!_vm->shouldQuit() && key2 == 254 && (delay || (playingSpeech && sound.isSpeechPlaying()))
 		&& !events._released && !events._rightReleased);
 
-	// If voices was set 2 to indicate a voice file was place, then reset it back to 1
+	// If voices was set 2 to indicate a Scalpel voice file was playing, then reset it back to 1
 	if (sound._voices == 2)
 		sound._voices = 1;
 






More information about the Scummvm-git-logs mailing list