From aa6ec62e9db78db12912d0e48025241c5d7ef4f7 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 22 Feb 2004 14:11:16 +0000 Subject: Patch #885904 (Flac Support) with some tweaks by me svn-id: r12984 --- queen/defs.h | 3 ++- queen/sound.cpp | 15 +++++++++++++++ queen/sound.h | 9 +++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) (limited to 'queen') diff --git a/queen/defs.h b/queen/defs.h index e64cd99e89..aed9ce9e09 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -29,7 +29,8 @@ namespace Queen { enum { COMPRESSION_NONE = 0, COMPRESSION_MP3 = 1, - COMPRESSION_OGG = 2 + COMPRESSION_OGG = 2, + COMPRESSION_FLAC = 3 }; enum { diff --git a/queen/sound.cpp b/queen/sound.cpp index c403d32b1c..9b2d452b20 100644 --- a/queen/sound.cpp +++ b/queen/sound.cpp @@ -61,6 +61,14 @@ Sound *Sound::giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression) { return new OGGSound(mixer, vm); #endif break; + case COMPRESSION_FLAC: + #ifndef USE_FLAC + warning("Using FLAC compressed datafile, but FLAC support not compiled in"); + return new SilentSound(mixer, vm); + #else + return new FLACSound(mixer, vm); + #endif + break; default: warning("Unknown compression type"); return new SilentSound(mixer, vm); @@ -184,4 +192,11 @@ void OGGSound::sfxPlay(const char *name, bool isSpeech) { } #endif +#ifdef USE_FLAC +void FLACSound::sfxPlay(const char *name, bool isSpeech) { + if (_vm->resource()->fileExists(name)) + _mixer->playFlac(isSpeech ? &_speechHandle : &_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name)); +} +#endif + } //End of namespace Queen diff --git a/queen/sound.h b/queen/sound.h index 2bc0ec04c4..bbc48b0cea 100644 --- a/queen/sound.h +++ b/queen/sound.h @@ -133,6 +133,15 @@ public: void sfxPlay(const char *name, bool isSpeech); }; #endif + +#ifdef USE_FLAC +class FLACSound : public Sound { +public: + FLACSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}; + void sfxPlay(const char *name, bool isSpeech); +}; +#endif // #ifdef USE_FLAC + } // End of namespace Queen #endif -- cgit v1.2.3