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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Jan 4 16:44:34 CET 2009


Revision: 35727
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35727&view=rev
Author:   thebluegr
Date:     2009-01-04 15:44:33 +0000 (Sun, 04 Jan 2009)

Log Message:
-----------
Got rid of explicit game sound info

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

Modified: scummvm/trunk/engines/saga/detection.cpp
===================================================================
--- scummvm/trunk/engines/saga/detection.cpp	2009-01-04 15:37:46 UTC (rev 35726)
+++ scummvm/trunk/engines/saga/detection.cpp	2009-01-04 15:44:33 UTC (rev 35727)
@@ -51,25 +51,13 @@
 	const GameResourceDescription *resourceDescription;
 	int fontsCount;
 	const GameFontDescription *fontDescriptions;
-	const GameSoundInfo *voiceInfo;
-	const GameSoundInfo *sfxInfo;
 	const GamePatchDescription *patchDescriptions;
 };
 
 bool SagaEngine::isBigEndian() const { return isMacResources() && getGameId() == GID_ITE; }
 bool SagaEngine::isMacResources() const { return (getPlatform() == Common::kPlatformMacintosh); }
 const GameResourceDescription *SagaEngine::getResourceDescription() { return _gameDescription->resourceDescription; }
-const GameSoundInfo *SagaEngine::getVoiceInfo() const { return _gameDescription->voiceInfo; }
-const GameSoundInfo *SagaEngine::getSfxInfo() const { return _gameDescription->sfxInfo; }
-const GameSoundInfo *SagaEngine::getMusicInfo() const {
-	static GameSoundInfo musicInfo;
-	musicInfo.resourceType = kSoundPCM;
-	musicInfo.sampleBits = 16;
-	musicInfo.isSigned = true;
 
-	return &musicInfo;
-}
-
 const GameFontDescription *SagaEngine::getFontDescription(int index) {
 	assert(index < _gameDescription->fontsCount);
 	return &_gameDescription->fontDescriptions[index];

Modified: scummvm/trunk/engines/saga/detection_tables.h
===================================================================
--- scummvm/trunk/engines/saga/detection_tables.h	2009-01-04 15:37:46 UTC (rev 35726)
+++ scummvm/trunk/engines/saga/detection_tables.h	2009-01-04 15:44:33 UTC (rev 35727)
@@ -112,14 +112,6 @@
 // Font 6 is kIHNMFont8, font 8 is kIHNMMainFont
 static const GameFontDescription IHNMCD_GameFonts[]     = { {2}, {3}, {4}, {5}, {6}, {7}, {8} };
 
-// Game sound overrides
-// Information for WAV, VOC, AIFF and Shorten audio files is obtained automatically. For other
-// audio types, we specify it here
-//                                                         sampleBits,  isSigned
-static const GameSoundInfo ITE_GameSound         = { kSoundPCM,    16,  true  };
-static const GameSoundInfo ITEWINDEMO1_GameSound = { kSoundPCM,     8,  false };
-static const GameSoundInfo ITEDEMO_GameVoice     = { kSoundVOX,    16,  true  };
-
 // Patch files. Files not found will be ignored
 static const GamePatchDescription ITEPatch_Files[] = {
 	{       "cave.mid", GAME_RESOURCEFILE,    9},
@@ -209,8 +201,6 @@
 		ARRAYSIZE(ITEDEMO_GameFonts),
 		ITEDEMO_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 #endif
 
@@ -234,8 +224,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
-		&ITEDEMO_GameVoice,
-		&ITE_GameSound,
 		ITEMacPatch_Files,
 	},
 
@@ -261,8 +249,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
-		&ITEDEMO_GameVoice,
-		&ITE_GameSound,
 		ITEMacPatch_Files,
 	},
 
@@ -288,8 +274,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
-		&ITEDEMO_GameVoice,
-		&ITE_GameSound,
 		ITEPatch_Files,
 	},
 
@@ -310,13 +294,11 @@
 			Common::ADGF_DEMO
 		},
 		GID_ITE,
-		GF_WYRMKEEP | GF_NON_INTERACTIVE,
+		GF_WYRMKEEP | GF_NON_INTERACTIVE | GF_8BIT_UNSIGNED_PCM,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
-		&ITEWINDEMO1_GameSound,
-		&ITEWINDEMO1_GameSound,
 		ITEPatch_Files,
 	},
 
@@ -349,8 +331,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
-		&ITE_GameSound,
-		&ITE_GameSound,
 		NULL,
 	},
 
@@ -374,8 +354,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFonts),
 		ITEWINDEMO_GameFonts,
-		&ITE_GameSound,
-		&ITE_GameSound,
 		ITEMacPatch_Files,
 	},
 
@@ -407,8 +385,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		&ITE_GameSound,
-		&ITE_GameSound,
 		NULL,
 	},
 
@@ -438,8 +414,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		&ITE_GameSound,
-		&ITE_GameSound,
 		NULL,
 	},
 
@@ -463,8 +437,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		&ITE_GameSound,
-		&ITE_GameSound,
 		ITEPatch_Files,
 	},
 
@@ -488,8 +460,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		&ITE_GameSound,
-		&ITE_GameSound,
 		ITEPatch_Files,
 	},
 
@@ -513,8 +483,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		&ITE_GameSound,
-		&ITE_GameSound,
 		ITEPatch_Files,
 	},
 
@@ -539,8 +507,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		&ITE_GameSound,
-		&ITE_GameSound,
 		NULL,
 	},
 
@@ -568,8 +534,6 @@
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 
 	// Inherit the earth - Disk version
@@ -592,8 +556,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		NULL,
-		NULL,
 		ITEPatch_Files,
 	},
 
@@ -617,8 +579,6 @@
 		&ITE_Resources,
 		ARRAYSIZE(ITE_GameFonts),
 		ITE_GameFonts,
-		NULL,
-		NULL,
 		ITEPatch_Files,
 	},
 
@@ -652,8 +612,6 @@
 		ARRAYSIZE(IHNMDEMO_GameFonts),
 		IHNMDEMO_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 
 	// I Have No Mouth And I Must Scream - English CD version
@@ -685,8 +643,6 @@
 		ARRAYSIZE(IHNMCD_GameFonts),
 		IHNMCD_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 
 	// I Have No Mouth And I Must Scream - De CD version
@@ -716,8 +672,6 @@
 		ARRAYSIZE(IHNMCD_GameFonts),
 		IHNMCD_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 
 	// I Have No Mouth And I Must Scream - Sp CD version
@@ -745,8 +699,6 @@
 		ARRAYSIZE(IHNMCD_GameFonts),
 		IHNMCD_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 
 	// I Have No Mouth And I Must Scream - Fr CD version
@@ -775,8 +727,6 @@
 		ARRAYSIZE(IHNMCD_GameFonts),
 		IHNMCD_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 
 	// I Have No Mouth And I Must Scream - Italian fan CD translation
@@ -804,8 +754,6 @@
 		ARRAYSIZE(IHNMCD_GameFonts),
 		IHNMCD_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 	// I Have No Mouth And I Must Scream - Mac English CD
 	{
@@ -830,8 +778,6 @@
 		ARRAYSIZE(IHNMCD_GameFonts),
 		IHNMCD_GameFonts,
 		NULL,
-		NULL,
-		NULL,
 	},
 #endif
 
@@ -866,14 +812,12 @@
 		NULL,	// game resources
 		0,		// number of fonts
 		NULL,	// font array
-		NULL,	// voice info
-		NULL,	// SFX info
 		NULL,
 	},
 
 #endif
 
-	{ AD_TABLE_END_MARKER, 0, 0, 0, NULL, 0, NULL, NULL, NULL, NULL }
+	{ AD_TABLE_END_MARKER, 0, 0, 0, NULL, 0, NULL, NULL }
 };
 
 } // End of namespace Saga

Modified: scummvm/trunk/engines/saga/music.cpp
===================================================================
--- scummvm/trunk/engines/saga/music.cpp	2009-01-04 15:37:46 UTC (rev 35726)
+++ scummvm/trunk/engines/saga/music.cpp	2009-01-04 15:44:33 UTC (rev 35727)
@@ -56,7 +56,6 @@
 	int16 _buf[BUFFER_SIZE];
 	const int16 *_bufferEnd;
 	const int16 *_pos;
-	const GameSoundInfo *_musicInfo;
 	MemoryReadStream *_memoryStream;
 	SagaEngine *_vm;
 
@@ -88,12 +87,7 @@
 
 	resourceData = context->getResourceData(resourceId);
 	_file = context->getFile(resourceData);
-	_musicInfo = _vm->getMusicInfo();
 
-	if (_musicInfo == NULL) {
-		error("DigitalMusicInputStream() wrong musicInfo");
-	}
-
 	_compressedStream = NULL;
 
 	if (context->isCompressed) {

Modified: scummvm/trunk/engines/saga/saga.h
===================================================================
--- scummvm/trunk/engines/saga/saga.h	2009-01-04 15:37:46 UTC (rev 35726)
+++ scummvm/trunk/engines/saga/saga.h	2009-01-04 15:44:33 UTC (rev 35727)
@@ -123,7 +123,8 @@
 	GF_MONO_MUSIC        = 1 << 5,
 	GF_EXTRA_ITE_CREDITS = 1 << 6,
 	GF_IHNM_DEMO         = 1 << 7,
-	GF_LE_VOICES         = 1 << 8
+	GF_LE_VOICES         = 1 << 8,
+	GF_8BIT_UNSIGNED_PCM = 1 << 9
 };
 
 enum VerbTypeIds {
@@ -288,12 +289,6 @@
 
 struct GameDisplayInfo;
 
-struct GameSoundInfo {
-	GameSoundTypes resourceType;
-	int sampleBits;
-	bool isSigned;
-};
-
 struct GamePatchDescription {
 	const char *fileName;
 	uint16 fileType;
@@ -594,9 +589,6 @@
 	bool isMacResources() const;
 	bool isSaga2() const { return getGameId() == GID_DINO || getGameId() == GID_FTA2; }
 	const GameResourceDescription *getResourceDescription();
-	const GameSoundInfo *getVoiceInfo() const;
-	const GameSoundInfo *getSfxInfo() const;
-	const GameSoundInfo *getMusicInfo() const;
 
 	const GameFontDescription *getFontDescription(int index);
 	int getFontsCount() const;

Modified: scummvm/trunk/engines/saga/sndres.cpp
===================================================================
--- scummvm/trunk/engines/saga/sndres.cpp	2009-01-04 15:37:46 UTC (rev 35726)
+++ scummvm/trunk/engines/saga/sndres.cpp	2009-01-04 15:44:33 UTC (rev 35727)
@@ -189,13 +189,11 @@
 	Audio::AudioStream *voxStream;
 	size_t soundResourceLength;
 	bool result = false;
-	GameSoundTypes resourceType;
+	GameSoundTypes resourceType = kSoundPCM;
 	byte *data = 0;
 	int rate;
 	int size;
 	byte flags = 0;
-	size_t voxSize;
-	const GameSoundInfo *soundInfo = 0;
 	Common::File* file;
 
 	if (resourceId == (uint32)-1) {
@@ -234,12 +232,6 @@
 
 	Common::SeekableReadStream& readS = *file;
 
-	if (context->fileType & GAME_VOICEFILE) {
-		soundInfo = _vm->getVoiceInfo();
-	} else {
-		soundInfo = _vm->getSfxInfo();
-	}
-
 	if (soundResourceLength >= 8) {
 		byte header[8];
 
@@ -254,8 +246,6 @@
 			resourceType = kSoundAIFF;
 		} else if (!memcmp(header, "ajkg", 4) != 0) {
 			resourceType = kSoundShorten;
-		} else if (soundInfo) {
-			resourceType = soundInfo->resourceType;
 		}
 
 		bool uncompressedSound = false;
@@ -280,6 +270,7 @@
 
 	}
 
+	// Default sound type is 16-bit PCM (used in ITE)
 	buffer.isBigEndian = context->isBigEndian;
 	if ((context->fileType & GAME_VOICEFILE) && (_vm->getFeatures() & GF_LE_VOICES))
 		buffer.isBigEndian = false;
@@ -287,7 +278,19 @@
 	buffer.soundType = resourceType;
 	buffer.originalSize = 0;
 	buffer.stereo = false;
+	buffer.isSigned = true;			// default for PCM and VOX
 	buffer.frequency = 22050;		// default for PCM and VOX
+	buffer.sampleBits = 16;			// default for PCM and VOX
+	if (_vm->getGameId() == GID_ITE) {
+		if (_vm->getFeatures() & GF_8BIT_UNSIGNED_PCM) {	// older ITE demos
+			buffer.isSigned = false;
+			buffer.sampleBits = 8;
+		} else {
+			// Voice files in newer ITE demo versions are OKI ADPCM (VOX) encoded
+			if (!scumm_stricmp(context->fileName, "voicesd.rsc"))
+				resourceType = kSoundVOX;
+		}
+	}
 	buffer.buffer = NULL;
 
 	// Older Mac versions of ITE were Macbinary packed
@@ -295,8 +298,6 @@
 
 	switch (resourceType) {
 	case kSoundPCM:
-		buffer.isSigned = soundInfo->isSigned;
-		buffer.sampleBits = soundInfo->sampleBits;
 		buffer.size = soundResourceLength - soundOffset;
 		if (!onlyHeader) {
 			buffer.buffer = (byte *) malloc(buffer.size);
@@ -307,16 +308,11 @@
 		result = true;
 		break;
 	case kSoundVOX:
-		buffer.isSigned = soundInfo->isSigned;
-		buffer.sampleBits = soundInfo->sampleBits;
 		buffer.size = soundResourceLength * 4;
 		if (!onlyHeader) {
 			voxStream = Audio::makeADPCMStream(&readS, false, soundResourceLength, Audio::kADPCMOki);
 			buffer.buffer = (byte *)malloc(buffer.size);
-			voxSize = voxStream->readBuffer((int16*)buffer.buffer, soundResourceLength * 2);
-			if (voxSize != soundResourceLength * 2) {
-				error("SndRes::load() wrong VOX output size");
-			}
+			voxStream->readBuffer((int16*)buffer.buffer, soundResourceLength * 2);
 			delete voxStream;
 		}
 		result = true;


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