mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-26 11:46:54 +00:00
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:
parent
30d3cc541a
commit
69f389cc15
@ -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('.')) {
|
||||||
filename += ".SND";
|
if (IS_SERRATED_SCALPEL) {
|
||||||
|
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,40 +143,47 @@ 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());
|
||||||
|
|
||||||
stream->skip(2);
|
Audio::AudioStream *audioStream;
|
||||||
int size = stream->readUint32BE();
|
|
||||||
int rate = stream->readUint16BE();
|
|
||||||
byte *data = (byte *)malloc(size);
|
|
||||||
byte *ptr = data;
|
|
||||||
stream->read(ptr, size);
|
|
||||||
delete stream;
|
|
||||||
|
|
||||||
assert(size > 2);
|
if (IS_SERRATED_SCALPEL) {
|
||||||
|
stream->skip(2);
|
||||||
|
int size = stream->readUint32BE();
|
||||||
|
int rate = stream->readUint16BE();
|
||||||
|
byte *data = (byte *)malloc(size);
|
||||||
|
byte *ptr = data;
|
||||||
|
stream->read(ptr, size);
|
||||||
|
delete stream;
|
||||||
|
|
||||||
byte *decoded = (byte *)malloc((size - 1) * 2);
|
assert(size > 2);
|
||||||
|
|
||||||
// Holmes uses Creative ADPCM 4-bit data
|
byte *decoded = (byte *)malloc((size - 1) * 2);
|
||||||
int counter = 0;
|
|
||||||
byte reference = ptr[0];
|
|
||||||
int16 scale = 0;
|
|
||||||
|
|
||||||
for(int i = 1; i < size; i++) {
|
// Holmes uses Creative ADPCM 4-bit data
|
||||||
decoded[counter++] = decodeSample((ptr[i]>>4)&0x0f, reference, scale);
|
int counter = 0;
|
||||||
decoded[counter++] = decodeSample((ptr[i]>>0)&0x0f, reference, scale);
|
byte reference = ptr[0];
|
||||||
}
|
int16 scale = 0;
|
||||||
|
|
||||||
free(data);
|
for(int i = 1; i < size; i++) {
|
||||||
|
decoded[counter++] = decodeSample((ptr[i]>>4)&0x0f, reference, scale);
|
||||||
|
decoded[counter++] = decodeSample((ptr[i]>>0)&0x0f, reference, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(data);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Debug : used to dump files
|
// Debug : used to dump files
|
||||||
Common::DumpFile outFile;
|
Common::DumpFile outFile;
|
||||||
outFile.open(filename);
|
outFile.open(filename);
|
||||||
outFile.write(decoded, (size - 2) * 2);
|
outFile.write(decoded, (size - 2) * 2);
|
||||||
outFile.flush();
|
outFile.flush();
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user