[Scummvm-cvs-logs] scummvm master -> e6d8655a9b37af313840cca05b0e3493624ca575

Strangerke Strangerke at scummvm.org
Mon Jan 4 13:50:35 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e6d8655a9b TONY: Add support to the new compressed speech containers


Commit: e6d8655a9b37af313840cca05b0e3493624ca575
    https://github.com/scummvm/scummvm/commit/e6d8655a9b37af313840cca05b0e3493624ca575
Author: Strangerke (strangerke at scummvm.org)
Date: 2016-01-04T13:43:36+01:00

Commit Message:
TONY: Add support to the new compressed speech containers

Changed paths:
    engines/tony/sound.cpp
    engines/tony/tony.cpp
    engines/tony/tony.h



diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp
index 7320565..aa86750 100644
--- a/engines/tony/sound.cpp
+++ b/engines/tony/sound.cpp
@@ -218,12 +218,45 @@ bool FPSfx::loadVoiceFromVDB(Common::File &vdbFP) {
 	if (!_soundSupported)
 		return true;
 
-	uint32 size = vdbFP.readUint32LE();
-	uint32 rate = vdbFP.readUint32LE();
-	_isVoice = true;
-
-	_rewindableStream = Audio::makeADPCMStream(vdbFP.readStream(size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, 1);
+	switch (g_vm->_vdbCodec) {
+	case FPCODEC_ADPCM: {
+		uint32 size = vdbFP.readUint32LE();
+		uint32 rate = vdbFP.readUint32LE();
 
+		_rewindableStream = Audio::makeADPCMStream(vdbFP.readStream(size), DisposeAfterUse::YES, 0, Audio::kADPCMDVI, rate, 1);
+		}
+		break;
+	case FPCODEC_MP3 : {
+#ifdef USE_MAD
+		uint32 size = vdbFP.readUint32LE();
+		_rewindableStream = Audio::makeMP3Stream(vdbFP.readStream(size), DisposeAfterUse::YES);
+#else
+		return false;
+#endif
+		}
+		break;
+	case FPCODEC_OGG : {
+#ifdef USE_VORBIS
+		uint32 size = vdbFP.readUint32LE();
+		_rewindableStream = Audio::makeVorbisStream(vdbFP.readStream(size), DisposeAfterUse::YES);
+#else
+		return false;
+#endif
+		}
+		break;
+	case FPCODEC_FLAC : {
+#ifdef USE_FLAC
+		uint32 size = vdbFP.readUint32LE();
+		_rewindableStream = Audio::makeFLACStream(vdbFP.readStream(size), DisposeAfterUse::YES);
+#else
+		return false;
+#endif
+		}
+		break;
+	default:
+		return false;
+	}
+	_isVoice = true;
 	_fileLoaded = true;
 	setVolume(62);
 	return true;
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index 67ffd36..6308cf6 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -577,18 +577,49 @@ bool TonyEngine::openVoiceDatabase() {
 	uint32 numfiles;
 
 	// Open the voices database
-	if (!_vdbFP.open("voices.vdb"))
+	if (_vdbFP.open("voices.vdb"))
+		_vdbCodec = FPCODEC_ADPCM;
+	else if (_vdbFP.open("voices.mdb"))
+		_vdbCodec = FPCODEC_MP3;
+	else if (_vdbFP.open("voices.odb"))
+		_vdbCodec = FPCODEC_OGG;
+	else if (_vdbFP.open("voices.fdb"))
+		_vdbCodec = FPCODEC_FLAC;
+	else
 		return false;
 
 	_vdbFP.seek(-8, SEEK_END);
 	numfiles = _vdbFP.readUint32LE();
 	_vdbFP.read(id, 4);
 
-	if (id[0] != 'V' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
-		_vdbFP.close();
+	switch (_vdbCodec) {
+	case FPCODEC_ADPCM:
+		if (id[0] != 'V' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+			_vdbFP.close();
+			return false;
+		}
+		break;
+	case FPCODEC_MP3:
+		if (id[0] != 'M' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+			_vdbFP.close();
+			return false;
+		}
+		break;
+	case FPCODEC_OGG:
+		if (id[0] != 'O' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+			_vdbFP.close();
+			return false;
+		}
+		break;
+	case FPCODEC_FLAC:
+		if (id[0] != 'F' || id[1] != 'D' || id[2] != 'B' || id[3] != '1') {
+			_vdbFP.close();
+			return false;
+		}
+		break;
+	default:
 		return false;
 	}
-
 	// Read in the index
 	_vdbFP.seek(-8 - (numfiles * VOICE_HEADER_SIZE), SEEK_END);
 
diff --git a/engines/tony/tony.h b/engines/tony/tony.h
index 40a5184..40bace8 100644
--- a/engines/tony/tony.h
+++ b/engines/tony/tony.h
@@ -104,6 +104,7 @@ public:
 	RMResUpdate _resUpdate;
 	uint32 _hEndOfFrame;
 	Common::File _vdbFP;
+	SoundCodecs _vdbCodec;
 	Common::Array<VoiceHeader> _voices;
 	FPSound _theSound;
 	Common::List<FPSfx *> _activeSfx;






More information about the Scummvm-git-logs mailing list