[Scummvm-cvs-logs] scummvm master -> 237d1149b5ab8cd00baa902ad951a01889383362
dreammaster
dreammaster at scummvm.org
Wed Aug 12 02:31:05 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:
237d1149b5 SHERLOCK: RT: Don't error out if a speech resource doesn't exist
Commit: 237d1149b5ab8cd00baa902ad951a01889383362
https://github.com/scummvm/scummvm/commit/237d1149b5ab8cd00baa902ad951a01889383362
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-08-11T20:30:04-04:00
Commit Message:
SHERLOCK: RT: Don't error out if a speech resource doesn't exist
Changed paths:
engines/sherlock/sound.cpp
engines/sherlock/tattoo/tattoo_talk.cpp
engines/sherlock/tattoo/tattoo_user_interface.cpp
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index d4907e0..013b0fd 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -267,10 +267,24 @@ void Sound::playSpeech(const Common::String &name) {
Scene &scene = *_vm->_scene;
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))
+ || (!scumm_strnicmp(name.c_str(), "HOLM12X", 7)))
+ libraryName = "SPEECH12.LIB";
+
+ // If the speech library file doesn't even exist, then we can't play anything
+ Common::File f;
+ if (!f.exists(libraryName))
+ return;
+
+ // Ensure the given library is in the cache
res.addToCache(libraryName);
- // TODO: Doesn't seem to be WAV files. Need to find out what format it is..
+ if (!res.exists(name))
+ // No voice resource for the given name, so we have nothing to play
+ return;
+
Common::SeekableReadStream *stream = res.load(name, libraryName);
Audio::AudioStream *audioStream = Audio::makeRawStream(stream, 11025, Audio::FLAG_UNSIGNED);
_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, audioStream, -1, Audio::Mixer::kMaxChannelVolume);
@@ -279,6 +293,7 @@ void Sound::playSpeech(const Common::String &name) {
void Sound::stopSpeech() {
_mixer->stopHandle(_speechHandle);
+ _speechPlaying = false;
}
bool Sound::isSpeechPlaying() {
diff --git a/engines/sherlock/tattoo/tattoo_talk.cpp b/engines/sherlock/tattoo/tattoo_talk.cpp
index d16e26f..816e0e2 100644
--- a/engines/sherlock/tattoo/tattoo_talk.cpp
+++ b/engines/sherlock/tattoo/tattoo_talk.cpp
@@ -186,11 +186,10 @@ TattooTalk::TattooTalk(SherlockEngine *vm) : Talk(vm), _talkWidget(vm), _passwor
void TattooTalk::talkInterface(const byte *&str) {
TattooEngine &vm = *(TattooEngine *)_vm;
Sound &sound = *_vm->_sound;
- Talk &talk = *_vm->_talk;
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
const byte *s = str;
- if (!vm._textWindowsOn && sound._speechOn && talk._speaker != -1)
+ if (!vm._textWindowsOn && sound._speechOn && _speaker != -1)
return;
// Move to past the end of the text string
diff --git a/engines/sherlock/tattoo/tattoo_user_interface.cpp b/engines/sherlock/tattoo/tattoo_user_interface.cpp
index 275ba2f..f9d6194 100644
--- a/engines/sherlock/tattoo/tattoo_user_interface.cpp
+++ b/engines/sherlock/tattoo/tattoo_user_interface.cpp
@@ -132,14 +132,14 @@ void TattooUserInterface::lookAtObject() {
while ((*p == ' ') || (*p == '='))
++p;
- // If it's not "NONE", play the Sound File
+ // If it's not "NONE", play the speech File
Common::String soundName(p);
if (soundName.compareToIgnoreCase("NONE")) {
soundName.toLowercase();
if (!soundName.contains('.'))
soundName += ".wav";
- sound.playSound(soundName, WAIT_RETURN_IMMEDIATELY);
+ sound.playSpeech(soundName);
}
break;
More information about the Scummvm-git-logs
mailing list