[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.480,1.481

Eugene Sandulenko sev at users.sourceforge.net
Tue Oct 18 20:31:11 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22363

Modified Files:
	sound.cpp 
Log Message:
Attempt to play IMA ADPCM speech in later HE games. For some reason
sound is noisy and all samples are cut in half. mplayer plays it with
same format without any noise but still half sample. It may happen
that original just played 2 consecutive samples or we read them wrong
from resources.


Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.480
retrieving revision 1.481
diff -u -d -r1.480 -r1.481
--- sound.cpp	18 Oct 2005 01:30:21 -0000	1.480
+++ sound.cpp	19 Oct 2005 03:29:55 -0000	1.481
@@ -33,6 +33,7 @@
 #include "common/timer.h"
 #include "common/util.h"
 
+#include "sound/adpcm.h"
 #include "sound/audiocd.h"
 #include "sound/flac.h"
 #include "sound/mididrv.h"
@@ -306,16 +307,24 @@
 	}
 	// Support for later Backyard sports games sounds
 	else if (READ_UINT32(ptr) == MKID('RIFF')) {
-		size = READ_BE_UINT32(ptr + 4);
+		uint16 type;
+		size = READ_LE_UINT32(ptr + 4);
 		Common::MemoryReadStream stream(ptr, size);
 
-		if (!loadWAVFromStream(stream, size, rate, flags)) {
+		if (!loadWAVFromStream(stream, size, rate, flags, &type)) {
 			error("playSound: Not a valid WAV file");
 		}
 
-		// Allocate a sound buffer, copy the data into it, and play
-		sound = (char *)malloc(size);
-		memcpy(sound, ptr + stream.pos(), size);
+		if (type == 17) {
+			AudioStream *voxStream = makeADPCMStream(stream, size, kADPCMIma);
+
+			sound = (char *)malloc(size * 2);
+			size = voxStream->readBuffer((int16*)sound, size * 2);
+		} else {
+			// Allocate a sound buffer, copy the data into it, and play
+			sound = (char *)malloc(size);
+			memcpy(sound, ptr + stream.pos(), size);
+		}
 		_vm->_mixer->playRaw(&_heSoundChannels[heChannel], sound, size, rate, flags, soundID);
 	}
 	// Support for Putt-Putt sounds - very hackish, too 8-)





More information about the Scummvm-git-logs mailing list