diff options
Diffstat (limited to 'engines/sherlock/sound.cpp')
-rw-r--r-- | engines/sherlock/sound.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp index 70451a68da..001907917f 100644 --- a/engines/sherlock/sound.cpp +++ b/engines/sherlock/sound.cpp @@ -45,7 +45,8 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer): _vm(vm), _mixer(mixer) { _speechOn = true; _vm->_res->addToCache("MUSIC.LIB"); - _vm->_res->addToCache(_vm->getGameID() == GType_SerratedScalpel ? "SND.SND" : "SOUND.LIB"); + _vm->_res->addToCache("TITLE.SND"); + _vm->_res->addToCache("EPILOGUE.SND"); } /** @@ -92,7 +93,11 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit Common::String filename = name; if (!filename.contains('.')) filename += ".SND"; - Common::SeekableReadStream *stream = _vm->_res->load(filename, "TITLE.SND"); + + Common::SeekableReadStream *stream = _vm->_res->load(filename); + + if (!stream) + error("Unable to find sound file '%s'", filename.c_str()); stream->skip(2); int size = stream->readUint32BE(); @@ -115,6 +120,15 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit free(data); +#if 0 + // Debug : used to dump files + Common::DumpFile outFile; + outFile.open(filename); + outFile.write(decoded, (size - 2) * 2); + outFile.flush(); + outFile.close(); +#endif + Audio::AudioStream *audioStream = Audio::makeRawStream(decoded, (size - 2) * 2, rate, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); _mixer->playStream(Audio::Mixer::kPlainSoundType, &_effectsHandle, audioStream, -1, Audio::Mixer::kMaxChannelVolume); _soundPlaying = true; @@ -138,14 +152,6 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit _soundPlaying = false; _mixer->stopHandle(_effectsHandle); -#if 0 - // Debug : used to dump files - Common::DumpFile outFile; - outFile.open(filename); - outFile.write(decoded, (size - 2) * 2); - outFile.flush(); - outFile.close(); -#endif return retval; } |