SHERLOCK: SS: Fix playback of voices in cutscenes

This commit is contained in:
Paul Gilbert 2015-10-10 16:38:28 -04:00
parent 1e0b18684c
commit 177409390f
4 changed files with 26 additions and 12 deletions

View file

@ -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;
}