From c6c056133c7720fc83de0513acbf4b0cc96bc50e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 May 2015 22:54:03 +0200 Subject: SHERLOCK: Remove useless checks in playSound --- engines/sherlock/sound.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp index 7b8d6c69c6..59098c32cc 100644 --- a/engines/sherlock/sound.cpp +++ b/engines/sherlock/sound.cpp @@ -95,17 +95,10 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit if (!filename.contains('.')) filename += ".SND"; - Common::SeekableReadStream *stream = nullptr; - - if (_vm->_res->exists(filename)) - stream = _vm->_res->load(filename, "TITLE.SND"); - else if (_vm->_res->exists(filename)) - stream = _vm->_res->load(filename, "EPILOGUE.SND"); - else if (_vm->_res->exists(filename)) - stream = _vm->_res->load(filename, "SND.SND"); + Common::SeekableReadStream *stream = _vm->_res->load(filename); if (!stream) - error("Unable to find sound file %s", filename.c_str()); + error("Unable to find sound file '%s'", filename.c_str()); stream->skip(2); int size = stream->readUint32BE(); @@ -128,6 +121,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; @@ -151,14 +153,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; } -- cgit v1.2.3