diff options
author | Robert Špalek | 2010-07-03 03:48:26 +0000 |
---|---|---|
committer | Robert Špalek | 2010-07-03 03:48:26 +0000 |
commit | 8d26e7c2d26c0a7c6521631bf861f8613a307dce (patch) | |
tree | e8680553dc433e75626ee57d85009673fee9c494 /engines/draci/draci.cpp | |
parent | aefc42ab0e066b6cd2fa6eaab2471a908d7bb1fb (diff) | |
download | scummvm-rg350-8d26e7c2d26c0a7c6521631bf861f8613a307dce.tar.gz scummvm-rg350-8d26e7c2d26c0a7c6521631bf861f8613a307dce.tar.bz2 scummvm-rg350-8d26e7c2d26c0a7c6521631bf861f8613a307dce.zip |
Dragon History tries uses compressed dubbing when available
Timing of speaking is not fixed yet.
svn-id: r50614
Diffstat (limited to 'engines/draci/draci.cpp')
-rw-r--r-- | engines/draci/draci.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 202bf6d187..cd3920b30d 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -71,7 +71,7 @@ const char *dubbingPath = "CD.SAM"; const char *musicPathMask = "HUDBA%d.MID"; const uint kSoundsFrequency = 13000; -const uint kDubbingFrequency = 22000; +const uint kDubbingFrequency = 22050; DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst) { @@ -105,6 +105,39 @@ bool DraciEngine::hasFeature(EngineFeature f) const { (f == kSupportsSavingDuringRuntime); } +static SoundArchive* openAnyPossibleDubbing() { + debugC(1, kDraciGeneralDebugLevel, "Trying to find original dubbing"); + LegacySoundArchive *legacy = new LegacySoundArchive(dubbingPath, kDubbingFrequency); + if (legacy->isOpen() && legacy->size()) { + debugC(1, kDraciGeneralDebugLevel, "Found original dubbing"); + return legacy; + } + delete legacy; + + // The original uncompressed dubbing cannot be found. Try to open the + // newer compressed version. + debugC(1, kDraciGeneralDebugLevel, "Trying to find compressed dubbing"); + ZipSoundArchive *zip = new ZipSoundArchive(); + + zip->openArchive("dub-raw.zzz", "buf", RAW80, kDubbingFrequency); + if (zip->isOpen() && zip->size()) return zip; +#ifdef USE_FLAC + zip->openArchive("dub-flac.zzz", "flac", FLAC); + if (zip->isOpen() && zip->size()) return zip; +#endif +#ifdef USE_VORBIS + zip->openArchive("dub-ogg.zzz", "ogg", OGG); + if (zip->isOpen() && zip->size()) return zip; +#endif +#ifdef USE_MAD + zip->openArchive("dub-mp3.zzz", "mp3", MP3); + if (zip->isOpen() && zip->size()) return zip; +#endif + + // Return an empty (but initialized) archive anyway. + return zip; +} + int DraciEngine::init() { // Initialize graphics using following: initGraphics(kScreenWidth, kScreenHeight, false); @@ -124,7 +157,7 @@ int DraciEngine::init() { _stringsArchive = new BArchive(stringsPath); _soundsArchive = new LegacySoundArchive(soundsPath, kSoundsFrequency); - _dubbingArchive = new LegacySoundArchive(dubbingPath, kDubbingFrequency); + _dubbingArchive = openAnyPossibleDubbing(); _sound = new Sound(_mixer); MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM); |