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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Apr 5 14:36:52 CEST 2008


Revision: 31404
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31404&view=rev
Author:   thebluegr
Date:     2008-04-05 05:36:52 -0700 (Sat, 05 Apr 2008)

Log Message:
-----------
Sound effects in the Macintosh version of IHNM are now working

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

Modified: scummvm/trunk/engines/saga/detection_tables.h
===================================================================
--- scummvm/trunk/engines/saga/detection_tables.h	2008-04-05 07:43:54 UTC (rev 31403)
+++ scummvm/trunk/engines/saga/detection_tables.h	2008-04-05 12:36:52 UTC (rev 31404)
@@ -104,12 +104,12 @@
 
 //                                                             frequency, sampleBits, stereo, isBigEndian, isSigned
 static const GameSoundInfo ITEPC_GameSound       = { kSoundPCM,    22050,         16,  false,       false,     true };
-static const GameSoundInfo ITEMAC_GameSound      = { kSoundPCM,    22050,         16,  false,        true,     true };
 static const GameSoundInfo ITEWINDEMO1_GameSound = { kSoundPCM,    22050,          8,  false,       false,    false };
 static const GameSoundInfo ITEMACCD_G_GameSound  = { kSoundMacPCM, 22050,          8,  false,       false,    false };
 static const GameSoundInfo ITEDISK_GameSound     = { kSoundVOC,       -1,         -1,  false,       false,     true };
 static const GameSoundInfo ITEDEMO_GameVoice     = { kSoundVOX,    22050,         16,  false,       false,     true };
 static const GameSoundInfo IHNM_GameSound        = { kSoundWAV,       -1,         -1,  false,       false,     true };
+static const GameSoundInfo MAC_GameSound         = { kSoundPCM,    22050,         16,  false,        true,     true };
 
 // Patch files. Files not found will be ignored
 static const GamePatchDescription ITEPatch_Files[] = {
@@ -161,7 +161,7 @@
 	{      "wyrm4.dlt", GAME_RESOURCEFILE, 1533, NULL},
 	{   "credit3m.dlt", GAME_RESOURCEFILE, 1796, NULL},
 	{   "credit4m.dlt", GAME_RESOURCEFILE, 1797, NULL},
-	{       "p2_a.iaf", GAME_VOICEFILE,       4, &ITEMAC_GameSound}
+	{       "p2_a.iaf", GAME_VOICEFILE,       4, &MAC_GameSound}
 };
 
 static const SAGAGameDescription gameDescriptions[] = {
@@ -226,7 +226,7 @@
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
 		&ITEDEMO_GameVoice,
-		&ITEMAC_GameSound,
+		&MAC_GameSound,
 		ARRAYSIZE(ITEMacPatch_Files),
 		ITEMacPatch_Files,
 	},
@@ -255,7 +255,7 @@
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
 		&ITEDEMO_GameVoice,
-		&ITEMAC_GameSound,
+		&MAC_GameSound,
 		ARRAYSIZE(ITEMacPatch_Files),
 		ITEMacPatch_Files,
 	},
@@ -375,8 +375,8 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
-		&ITEMAC_GameSound,
-		&ITEMAC_GameSound,
+		&MAC_GameSound,
+		&MAC_GameSound,
 		ARRAYSIZE(ITEMacPatch_Files),
 		ITEMacPatch_Files,
 	},
@@ -410,7 +410,7 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		&ITEMAC_GameSound,
+		&MAC_GameSound,
 		&ITEPC_GameSound,
 		0,
 		NULL,
@@ -442,7 +442,7 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		&ITEMAC_GameSound,
+		&MAC_GameSound,
 		&ITEPC_GameSound,
 		0,
 		NULL,
@@ -892,8 +892,8 @@
 		&IHNM_Resources,
 		ARRAYSIZE(IHNMCD_GameFonts),
 		IHNMCD_GameFonts,
-		&IHNM_GameSound,
-		&IHNM_GameSound,
+		&MAC_GameSound,
+		&MAC_GameSound,
 		0,
 		NULL,
 	},

Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h	2008-04-05 07:43:54 UTC (rev 31403)
+++ scummvm/trunk/engines/saga/saga.h	2008-04-05 12:36:52 UTC (rev 31404)
@@ -234,7 +234,8 @@
 	kSoundMacPCM = 4,
 	kSoundMP3 = 5,
 	kSoundOGG = 6,
-	kSoundFLAC = 7
+	kSoundFLAC = 7,
+	kSoundAIFF = 8
 };
 
 enum TextStringIds {

Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp	2008-04-05 07:43:54 UTC (rev 31403)
+++ scummvm/trunk/engines/saga/sndres.cpp	2008-04-05 12:36:52 UTC (rev 31404)
@@ -38,6 +38,7 @@
 #include "sound/voc.h"
 #include "sound/wave.h"
 #include "sound/adpcm.h"
+#include "sound/aiff.h"
 #include "sound/audiostream.h"
 
 namespace Saga {
@@ -170,8 +171,33 @@
 		return false;
 	}
 
-	_vm->_resource->loadResource(context, resourceId, soundResource, soundResourceLength);
+	if (_vm->getGameType() == GType_IHNM && _vm->isMacResources()) {
+		Common::File soundFile;
+		char soundFileName[40];
+		int dirIndex = 0;
+	
+		if ((context->fileType & GAME_VOICEFILE) != 0) {
+			// TODO
+			return false;
+		} else {
+			dirIndex = floor((float)(resourceId / 63));
 
+			if (resourceId <= 16)	// F in hex (1 char in hex)
+				sprintf(soundFileName, "SFX/SFX%d/SFX00%x", dirIndex, resourceId);
+			else if (resourceId <= 255)	// FF in hex (2 chars in hex)
+				sprintf(soundFileName, "SFX/SFX%d/SFX0%x", dirIndex, resourceId);
+			else
+				sprintf(soundFileName, "SFX/SFX%d/SFX%x", dirIndex, resourceId);
+		}
+		soundFile.open(soundFileName);
+		soundResourceLength = soundFile.size();
+		soundResource = new byte[soundResourceLength];
+		soundFile.read(soundResource, soundResourceLength);
+		soundFile.close();
+	} else {
+		_vm->_resource->loadResource(context, resourceId, soundResource, soundResourceLength);
+	}
+
 	if ((context->fileType & GAME_VOICEFILE) != 0) {
 		soundInfo = _vm->getVoiceInfo();
 	} else {
@@ -189,6 +215,8 @@
 			resourceType = kSoundVOC;
 		} else if (!memcmp(soundResource, "RIFF", 4) != 0) {
 			resourceType = kSoundWAV;
+		} else if (!memcmp(soundResource, "FORM", 4) != 0) {
+			resourceType = kSoundAIFF;
 		}
 
 		bool uncompressedSound = false;
@@ -302,6 +330,23 @@
 		}
 		free(soundResource);
 		break;
+	case kSoundAIFF:
+		if (Audio::loadAIFFFromStream(readS, size, rate, flags)) {
+			buffer.frequency = rate;
+			buffer.sampleBits = 16;
+			buffer.stereo = ((flags & Audio::Mixer::FLAG_STEREO) != 0);
+			buffer.isSigned = true;
+			buffer.size = size;
+			if (onlyHeader) {
+				buffer.buffer = NULL;
+			} else {
+				buffer.buffer = (byte *)malloc(size);
+				readS.read(buffer.buffer, size);
+			}
+			result = true;
+		}
+		free(soundResource);
+		break;
 	case kSoundMP3:
 	case kSoundOGG:
 	case kSoundFLAC:


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