[Scummvm-cvs-logs] scummvm master -> 69f389cc157fb8e1c4e9241d843fe8ad215b71f4

eriktorbjorn eriktorbjorn at telia.com
Fri Jun 5 00:49:47 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

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


Commit: 69f389cc157fb8e1c4e9241d843fe8ad215b71f4
    https://github.com/scummvm/scummvm/commit/69f389cc157fb8e1c4e9241d843fe8ad215b71f4
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2015-06-05T00:48:02+02:00

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

This allows the intro to run a tiny bit further, before crashing.

Changed paths:
    engines/sherlock/sound.cpp



diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index 6a9c00d..d4edc30 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -27,6 +27,7 @@
 #include "common/algorithm.h"
 #include "audio/mixer.h"
 #include "audio/decoders/raw.h"
+#include "audio/decoders/wave.h"
 
 namespace Sherlock {
 
@@ -128,8 +129,13 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit
 	stopSound();
 
 	Common::String filename = name;
-	if (!filename.contains('.'))
-		filename += ".SND";
+	if (!filename.contains('.')) {
+		if (IS_SERRATED_SCALPEL) {
+			filename += ".SND";
+		} else {
+			filename += ".WAV";
+		}
+	}
 
 	Common::String libFilename(libraryFilename);
 	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)
 		error("Unable to find sound file '%s'", filename.c_str());
 
-	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;
+	Audio::AudioStream *audioStream;
 
-	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
-	int counter = 0;
-	byte reference = ptr[0];
-	int16 scale = 0;
+		byte *decoded = (byte *)malloc((size - 1) * 2);
 
-	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);
-	}
+		// Holmes uses Creative ADPCM 4-bit data
+		int counter = 0;
+		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
-	// Debug : used to dump files
-	Common::DumpFile outFile;
-	outFile.open(filename);
-	outFile.write(decoded, (size - 2) * 2);
-	outFile.flush();
-	outFile.close();
+		// 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);
+		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);
 	_soundPlaying = true;
 	_curPriority = priority;






More information about the Scummvm-git-logs mailing list