[Scummvm-cvs-logs] SF.net SVN: scummvm: [22596] scummvm/trunk/sound/wave.cpp

kirben at users.sourceforge.net kirben at users.sourceforge.net
Tue May 23 23:13:00 CEST 2006


Revision: 22596
Author:   kirben
Date:     2006-05-23 23:11:39 -0700 (Tue, 23 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22596&view=rev

Log Message:
-----------
Fix compressed sound in makeWAVStream()

Modified Paths:
--------------
    scummvm/trunk/sound/wave.cpp
Modified: scummvm/trunk/sound/wave.cpp
===================================================================
--- scummvm/trunk/sound/wave.cpp	2006-05-24 05:17:48 UTC (rev 22595)
+++ scummvm/trunk/sound/wave.cpp	2006-05-24 06:11:39 UTC (rev 22596)
@@ -162,22 +162,33 @@
 
 AudioStream *makeWAVStream(Common::SeekableReadStream &stream) {
 	int size, rate;
-	byte flags;
+	byte *data, flags;
 	uint16 type;
 	int blockAlign;
 
 	if (!loadWAVFromStream(stream, size, rate, flags, &type, &blockAlign))
 		return 0;
 
-	if (type == 17) // MS IMA ADPCM
-		return makeADPCMStream(&stream, size, kADPCMMSIma, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1);
-	if (type == 2) // MS ADPCM
-		return makeADPCMStream(&stream, size, kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
+	if (type == 17) { // MS IMA ADPCM
+		Audio::AudioStream *sndStream = Audio::makeADPCMStream(&stream, size, Audio::kADPCMMSIma, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
+		data = (byte *)malloc(size * 4);
+		assert(data);
+		size = sndStream->readBuffer((int16*)data, size * 2);
+		size *= 2; // 16bits.
+		delete sndStream;
+	} else if (type == 2) { // MS ADPCM
+		Audio::AudioStream *sndStream = Audio::makeADPCMStream(&stream, size, Audio::kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
+		data = (byte *)malloc(size * 4);
+		assert(data);
+		size = sndStream->readBuffer((int16*)data, size * 2);
+		size *= 2; // 16bits.
+		delete sndStream;
+	} else {
+		data = (byte *)malloc(size);
+		assert(data);
+		stream.read(data, size);
+	}
 
-	byte *data = (byte *)malloc(size);
-	assert(data);
-	stream.read(data, size);
-
 	// Since we allocated our own buffer for the data, we must set the autofree flag.
 	flags |= Audio::Mixer::FLAG_AUTOFREE;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list