diff options
author | Strangerke | 2016-01-04 13:43:36 +0100 |
---|---|---|
committer | Strangerke | 2016-01-04 13:43:36 +0100 |
commit | e6d8655a9b37af313840cca05b0e3493624ca575 (patch) | |
tree | b81864b13f8bc6789ea2a8af8ca98cc114182c1a /engines/tony | |
parent | 4ff70e97ae25781d9da7b5678b5e7b140831eb9f (diff) | |
download | scummvm-rg350-e6d8655a9b37af313840cca05b0e3493624ca575.tar.gz scummvm-rg350-e6d8655a9b37af313840cca05b0e3493624ca575.tar.bz2 scummvm-rg350-e6d8655a9b37af313840cca05b0e3493624ca575.zip |
TONY: Add support to the new compressed speech containers
Diffstat (limited to 'engines/tony')
-rw-r--r-- | engines/tony/sound.cpp | 43 | ||||
-rw-r--r-- | engines/tony/tony.cpp | 39 | ||||
-rw-r--r-- | engines/tony/tony.h | 1 |
3 files changed, 74 insertions, 9 deletions
diff --git a/engines/tony/sound.cpp b/engines/tony/sound.cpp index 73205655b0..aa86750ad5 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 67ffd36d57..6308cf6396 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 40a5184c31..40bace8db8 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; |