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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Jun 25 22:20:59 CEST 2007


Revision: 27717
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27717&view=rev
Author:   thebluegr
Date:     2007-06-25 13:20:59 -0700 (Mon, 25 Jun 2007)

Log Message:
-----------
Improvements to the SAGA compressed sound support

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

Modified: scummvm/trunk/engines/saga/detection_tables.h
===================================================================
--- scummvm/trunk/engines/saga/detection_tables.h	2007-06-25 19:10:50 UTC (rev 27716)
+++ scummvm/trunk/engines/saga/detection_tables.h	2007-06-25 20:20:59 UTC (rev 27717)
@@ -500,7 +500,7 @@
 		},
 		GType_ITE,
 		GID_ITE_MACCD,
-		GF_BIG_ENDIAN_DATA | GF_WYRMKEEP | GF_CD_FX,
+		GF_BIG_ENDIAN_DATA | GF_WYRMKEEP | GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
@@ -695,7 +695,7 @@
 		},
 		GType_ITE,
 		GID_ITE_MULTICD,
-		GF_WYRMKEEP | GF_CD_FX,
+		GF_WYRMKEEP | GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFonts),
@@ -757,7 +757,7 @@
 		},
 		GType_ITE,
 		GID_ITE_LINCD,
-		GF_WYRMKEEP | GF_CD_FX,
+		GF_WYRMKEEP | GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFonts),
@@ -817,7 +817,7 @@
 		},
 		GType_ITE,
 		GID_ITE_WINCD,
-		GF_WYRMKEEP | GF_CD_FX,
+		GF_WYRMKEEP | GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFonts),
@@ -877,7 +877,7 @@
 		},
 		GType_ITE,
 		GID_ITE_CD_G,
-		GF_CD_FX,
+		GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFonts),
@@ -939,7 +939,7 @@
 		},
 		GType_ITE,
 		GID_ITE_CD_G2,
-		GF_CD_FX,
+		GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFonts),
@@ -1001,7 +1001,7 @@
 		},
 		GType_ITE,
 		GID_ITE_CD_DE,
-		GF_CD_FX,
+		GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFonts),
@@ -1063,7 +1063,7 @@
 		},
 		GType_ITE,
 		GID_ITE_CD_DE2,
-		GF_CD_FX,
+		GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFonts),
@@ -1123,7 +1123,7 @@
 		},
 		GType_ITE,
 		GID_ITE_CD,
-		GF_CD_FX,
+		GF_CD_FX | GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFonts),
@@ -1181,7 +1181,7 @@
 		},
 		GType_ITE,
 		GID_ITE_DISK_DE,
-		0,
+		GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEDISK_GameFonts),
@@ -1241,7 +1241,7 @@
 		},
 		GType_ITE,
 		GID_ITE_DISK_DE2,
-		0,
+		GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEDISK_GameFonts),
@@ -1299,7 +1299,7 @@
 		},
 		GType_ITE,
 		GID_ITE_DISK_G,
-		0,
+		GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEDISK_GameFonts),
@@ -1359,7 +1359,7 @@
 		},
 		GType_ITE,
 		GID_ITE_DISK_G2,
-		0,
+		GF_COMPRESSED_SOUNDS,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEDISK_GameFonts),

Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h	2007-06-25 19:10:50 UTC (rev 27716)
+++ scummvm/trunk/engines/saga/saga.h	2007-06-25 20:20:59 UTC (rev 27717)
@@ -152,7 +152,8 @@
 	GF_BIG_ENDIAN_DATA   = 1 << 0,
 	GF_WYRMKEEP          = 1 << 1,
 	GF_CD_FX             = 1 << 2,
-	GF_SCENE_SUBSTITUTES = 1 << 3
+	GF_SCENE_SUBSTITUTES = 1 << 3,
+	GF_COMPRESSED_SOUNDS = 1 << 4
 };
 
 enum VerbTypeIds {

Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp	2007-06-25 19:10:50 UTC (rev 27716)
+++ scummvm/trunk/engines/saga/sndres.cpp	2007-06-25 20:20:59 UTC (rev 27717)
@@ -176,18 +176,18 @@
 			resourceType = kSoundVOC;
 		} else if (!memcmp(soundResource, "RIFF", 4) != 0) {
 			resourceType = kSoundWAV;
-		} else if (soundResource[0] == char(0)) {
-			readS.seek(1);		// Skip compression identifier byte
-			uint16 test = readS.readUint16LE();	// the frequency
-			// the sound's frequency is not supposed to be 0, if it is then it's an empty sound,
-			// so don't treat it as MP3
-			if (test > 0)				
+		} 
+		
+		if (_vm->getFeatures() & GF_COMPRESSED_SOUNDS) {
+			if (soundResource[0] == char(0)) {
 				resourceType = kSoundMP3;
-		} else if (soundResource[0] == char(1)) {
-			resourceType = kSoundOGG;
-		} else if (soundResource[0] == char(2)) {
-			resourceType = kSoundFLAC;
+			} else if (soundResource[0] == char(1)) {
+				resourceType = kSoundOGG;
+			} else if (soundResource[0] == char(2)) {
+				resourceType = kSoundFLAC;
+			}
 		}
+
 	}
 
 
@@ -198,7 +198,6 @@
 		buffer.sampleBits = soundInfo->sampleBits;
 		buffer.size = soundResourceLength;
 		buffer.stereo = soundInfo->stereo;
-		buffer.isCompressed = false;
 		if (onlyHeader) {
 			buffer.buffer = NULL;
 			free(soundResource);
@@ -213,7 +212,6 @@
 		buffer.sampleBits = soundInfo->sampleBits;
 		buffer.size = soundResourceLength - 36;
 		buffer.stereo = soundInfo->stereo;
-		buffer.isCompressed = false;
 		if (onlyHeader) {
 			buffer.buffer = NULL;
 		} else {
@@ -229,7 +227,6 @@
 		buffer.sampleBits = soundInfo->sampleBits;
 		buffer.stereo = soundInfo->stereo;
 		buffer.size = soundResourceLength * 4;
-		buffer.isCompressed = false;
 		if (onlyHeader) {
 			buffer.buffer = NULL;
 			free(soundResource);
@@ -252,7 +249,6 @@
 			buffer.stereo = false;
 			buffer.isSigned = false;
 			buffer.size = size;
-			buffer.isCompressed = false;
 			if (onlyHeader) {
 				buffer.buffer = NULL;
 				free(data);
@@ -270,7 +266,6 @@
 			buffer.stereo = ((flags & Audio::Mixer::FLAG_STEREO) != 0);
 			buffer.isSigned = true;
 			buffer.size = size;
-			buffer.isCompressed = false;
 			if (onlyHeader) {
 				buffer.buffer = NULL;
 			} else {
@@ -294,7 +289,6 @@
 		buffer.originalSize = readS.readUint32LE();
 		buffer.sampleBits = readS.readByte();
 		buffer.stereo = (readS.readByte() == char(0)) ? false : true;
-		buffer.isCompressed = true;
 		buffer.soundType = resourceType;
 		buffer.soundFile = context->getFile(resourceData);
 		buffer.fileOffset = resourceData->offset;
@@ -324,7 +318,7 @@
 		return -1;
 	}
 
-	if (!buffer.isCompressed)
+	if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS))
 		msDouble = (double)buffer.size;
 	else
 		msDouble = (double)buffer.originalSize;

Modified: scummvm/trunk/engines/saga/sound.cpp
===================================================================
--- scummvm/trunk/engines/saga/sound.cpp	2007-06-25 19:10:50 UTC (rev 27716)
+++ scummvm/trunk/engines/saga/sound.cpp	2007-06-25 20:20:59 UTC (rev 27717)
@@ -80,7 +80,7 @@
 	if (!buffer.isSigned)
 		flags |= Audio::Mixer::FLAG_UNSIGNED;
 
-	if (!buffer.isCompressed) {
+	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);

Modified: scummvm/trunk/engines/saga/sound.h
===================================================================
--- scummvm/trunk/engines/saga/sound.h	2007-06-25 19:10:50 UTC (rev 27716)
+++ scummvm/trunk/engines/saga/sound.h	2007-06-25 20:20:59 UTC (rev 27717)
@@ -54,7 +54,6 @@
 	size_t size;
 	size_t originalSize;
 	bool isBigEndian;
-	bool isCompressed;
 	GameSoundTypes soundType;
 	Common::File *soundFile;
 	size_t fileOffset;


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