SHERLOCK: Use standard WAV decoder for The Case of the Rose Tattoo

This allows the intro to run a tiny bit further, before crashing.
This commit is contained in:
Torbjörn Andersson 2015-06-05 00:48:02 +02:00
parent 30d3cc541a
commit 69f389cc15

View File

@ -27,6 +27,7 @@
#include "common/algorithm.h" #include "common/algorithm.h"
#include "audio/mixer.h" #include "audio/mixer.h"
#include "audio/decoders/raw.h" #include "audio/decoders/raw.h"
#include "audio/decoders/wave.h"
namespace Sherlock { namespace Sherlock {
@ -128,8 +129,13 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit
stopSound(); stopSound();
Common::String filename = name; Common::String filename = name;
if (!filename.contains('.')) if (!filename.contains('.')) {
if (IS_SERRATED_SCALPEL) {
filename += ".SND"; filename += ".SND";
} else {
filename += ".WAV";
}
}
Common::String libFilename(libraryFilename); Common::String libFilename(libraryFilename);
Common::SeekableReadStream *stream = libFilename.empty() ? res.load(filename) : res.load(filename, libFilename); Common::SeekableReadStream *stream = libFilename.empty() ? res.load(filename) : res.load(filename, libFilename);
@ -137,6 +143,9 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit
if (!stream) if (!stream)
error("Unable to find sound file '%s'", filename.c_str()); error("Unable to find sound file '%s'", filename.c_str());
Audio::AudioStream *audioStream;
if (IS_SERRATED_SCALPEL) {
stream->skip(2); stream->skip(2);
int size = stream->readUint32BE(); int size = stream->readUint32BE();
int rate = stream->readUint16BE(); int rate = stream->readUint16BE();
@ -170,7 +179,11 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit
outFile.close(); outFile.close();
#endif #endif
Audio::AudioStream *audioStream = Audio::makeRawStream(decoded, (size - 2) * 2, rate, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); audioStream = Audio::makeRawStream(decoded, (size - 2) * 2, rate, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
} else {
audioStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
}
_mixer->playStream(Audio::Mixer::kPlainSoundType, &_effectsHandle, audioStream, -1, Audio::Mixer::kMaxChannelVolume); _mixer->playStream(Audio::Mixer::kPlainSoundType, &_effectsHandle, audioStream, -1, Audio::Mixer::kMaxChannelVolume);
_soundPlaying = true; _soundPlaying = true;
_curPriority = priority; _curPriority = priority;