[Scummvm-cvs-logs] SF.net SVN: scummvm: [28018] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Jul 11 01:22:45 CEST 2007


Revision: 28018
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28018&view=rev
Author:   thebluegr
Date:     2007-07-10 16:22:44 -0700 (Tue, 10 Jul 2007)

Log Message:
-----------
Fix for bug #1751344 - "ITE: p2_a.iaf not played correctly"

Modified Paths:
--------------
    scummvm/trunk/engines/saga/sndres.cpp
    scummvm/trunk/engines/saga/sound.cpp

Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp	2007-07-10 21:24:58 UTC (rev 28017)
+++ scummvm/trunk/engines/saga/sndres.cpp	2007-07-10 23:22:44 UTC (rev 28018)
@@ -169,7 +169,6 @@
 	MemoryReadStream readS(soundResource, soundResourceLength);
 
 	resourceType = soundInfo->resourceType;
-	buffer.isBigEndian = soundInfo->isBigEndian;
 
 	if (soundResourceLength >= 8) {
 		if (!memcmp(soundResource, "Creative", 8)) {
@@ -178,7 +177,9 @@
 			resourceType = kSoundWAV;
 		} 
 		
-		if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS) {
+		// If the game has patch files, then it includes a patch file for sound resource 4, used in the intro.
+		// Don't treat this patch file as compressed sound. This file is always included if patch files are present
+		if ((_vm->getFeatures() & GF_COMPRESSED_SOUNDS) && !(_vm->getPatchesCount() > 0 && resourceId == 4)) {
 			if (soundResource[0] == char(0)) {
 				resourceType = kSoundMP3;
 			} else if (soundResource[0] == char(1)) {
@@ -190,6 +191,9 @@
 
 	}
 
+	buffer.isBigEndian = soundInfo->isBigEndian;
+	buffer.soundType = resourceType;
+	buffer.originalSize = 0;
 
 	switch (resourceType) {
 	case kSoundPCM:
@@ -319,7 +323,7 @@
 		return -1;
 	}
 
-	if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS))
+	if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS) || buffer.originalSize == 0)
 		msDouble = (double)buffer.size;
 	else
 		msDouble = (double)buffer.originalSize;

Modified: scummvm/trunk/engines/saga/sound.cpp
===================================================================
--- scummvm/trunk/engines/saga/sound.cpp	2007-07-10 21:24:58 UTC (rev 28017)
+++ scummvm/trunk/engines/saga/sound.cpp	2007-07-10 23:22:44 UTC (rev 28018)
@@ -83,31 +83,33 @@
 	if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS)) {
 		_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
 	} else {
-		buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
 		Audio::AudioStream *stream = NULL;
 
 		switch (buffer.soundType) {
 #ifdef USE_MAD
 			case kSoundMP3:
 				debug(1, "Playing MP3 compressed sound");
+				buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
 				stream = Audio::makeMP3Stream(buffer.soundFile, buffer.size);
 				break;
 #endif
 #ifdef USE_VORBIS
 			case kSoundOGG:
 				debug(1, "Playing OGG compressed sound");
+				buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
 				stream = Audio::makeVorbisStream(buffer.soundFile, buffer.size);
 				break;
 #endif
 #ifdef USE_FLAC
 			case kSoundFLAC:
 				debug(1, "Playing FLAC compressed sound");
+				buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET);
 				stream = Audio::makeFlacStream(buffer.soundFile, buffer.size);
 				break;
 #endif
 			default:
-				// Unknown compression
-				error("Trying to play a compressed sound, but the compression is not known");
+				// No compression, play it as raw sound
+				_mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume);
 				break;
 		}
 


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