diff options
| author | Max Horn | 2004-02-22 14:11:16 +0000 |
|---|---|---|
| committer | Max Horn | 2004-02-22 14:11:16 +0000 |
| commit | aa6ec62e9db78db12912d0e48025241c5d7ef4f7 (patch) | |
| tree | 0afae2b795f07b9bd1c00dc75af3dca3864dac5f /simon | |
| parent | 6db3a8819e7ef847f6aefac8e40f542cad006481 (diff) | |
| download | scummvm-rg350-aa6ec62e9db78db12912d0e48025241c5d7ef4f7.tar.gz scummvm-rg350-aa6ec62e9db78db12912d0e48025241c5d7ef4f7.tar.bz2 scummvm-rg350-aa6ec62e9db78db12912d0e48025241c5d7ef4f7.zip | |
Patch #885904 (Flac Support) with some tweaks by me
svn-id: r12984
Diffstat (limited to 'simon')
| -rw-r--r-- | simon/intern.h | 4 | ||||
| -rw-r--r-- | simon/simon.cpp | 14 | ||||
| -rw-r--r-- | simon/sound.cpp | 41 |
3 files changed, 59 insertions, 0 deletions
diff --git a/simon/intern.h b/simon/intern.h index c948e3d64c..39d6d707cc 100644 --- a/simon/intern.h +++ b/simon/intern.h @@ -125,19 +125,23 @@ struct GameSpecificSettings { const char *voc_filename; const char *mp3_filename; const char *vorbis_filename; + const char *flac_filename; const char *voc_effects_filename; const char *mp3_effects_filename; const char *vorbis_effects_filename; + const char *flac_effects_filename; const char *gamepc_filename; #else const char gme_filename[12]; const char wav_filename[12]; const char voc_filename[12]; const char mp3_filename[12]; + const char flac_filename[12]; const char vorbis_filename[12]; const char voc_effects_filename[12]; const char mp3_effects_filename[12]; const char vorbis_effects_filename[12]; + const char flac_effects_filename[12]; const char gamepc_filename[12]; #endif }; diff --git a/simon/simon.cpp b/simon/simon.cpp index 46cf2d94a6..dac8e1bc8f 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -137,9 +137,11 @@ static const GameSpecificSettings simon1_settings = { "SIMON.VOC", // voc_filename "SIMON.MP3", // mp3_filename "SIMON.OGG", // vorbis_filename + "SIMON.FLA", // flac_filename "EFFECTS.VOC", // voc_effects_filename "EFFECTS.MP3", // mp3_effects_filename "EFFECTS.OGG", // vorbis_effects_filename + "EFFECTS.FLA", // flac_effects_filename "GAMEPC", // gamepc_filename }; @@ -149,9 +151,11 @@ static const GameSpecificSettings simon1acorn_settings = { "SIMON", // voc_filename "SIMON.MP3", // mp3_filename "SIMON.OGG", // vorbis_filename + "SIMON.FLA", // flac_filename "EFFECTS", // voc_effects_filename "EFFECTS.MP3", // mp3_effects_filename "EFFECTS.OGG", // vorbis_effects_filename + "EFFECTS.FLA", // flac_effects_filename "GAMEBASE", // gamepc_filename }; @@ -161,9 +165,11 @@ static const GameSpecificSettings simon1amiga_settings = { "", // voc_filename "SIMON.MP3", // mp3_filename "SIMON.OGG", // vorbis_filename + "SIMON.FLA", // flac_filename "", // voc_effects_filename "", // mp3_effects_filename "", // vorbis_effects_filename + "", // flac_effects_filename "gameamiga", // gamepc_filename }; @@ -173,9 +179,11 @@ static const GameSpecificSettings simon1demo_settings = { "", // voc_filename "", // mp3_filename "", // vorbis_filename + "", // flac_filename "", // voc_effects_filename "", // mp3_effects_filename "", // vorbis_effects_filename + "", // flac_effects_filename "GDEMO", // gamepc_filename }; @@ -185,9 +193,11 @@ static const GameSpecificSettings simon2win_settings = { "SIMON2.VOC", // voc_filename "SIMON2.MP3", // mp3_filename "SIMON2.OGG", // vorbis_filename + "SIMON2.FLA", // flac_filename "", // voc_effects_filename "", // mp3_effects_filename "", // vorbis_effects_filename + "", // flac_effects_filename "GSPTR30", // gamepc_filename }; @@ -197,9 +207,11 @@ static const GameSpecificSettings simon2mac_settings = { "", // voc_filename "SIMON2.MP3", // mp3_filename "SIMON2.OGG", // vorbis_filename + "SIMON2.FLA", // flac_filename "", // voc_effects_filename "", // mp3_effects_filename "", // vorbis_effects_filename + "", // flac_effects_filename "gsptr30", // gamepc_filename }; @@ -209,9 +221,11 @@ static const GameSpecificSettings simon2dos_settings = { "", // voc_filename "", // mp3_filename "", // vorbis_filename + "", // flac_filename "", // voc_effects_filename "", // mp3_effects_filename "", // vorbis_effects_filename + "", // flac_effects_filename "GAME32", // gamepc_filename }; #endif diff --git a/simon/sound.cpp b/simon/sound.cpp index 44201899f8..1d4dd92c3b 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -241,6 +241,30 @@ void VorbisSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) } #endif +#ifdef USE_FLAC +class FlacSound : public BaseSound { +public: + FlacSound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {}; + void playSound(uint sound, PlayingSoundHandle *handle, byte flags); +}; + +void FlacSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) +{ + if (_offsets == NULL) + return; + + _file->seek(_offsets[sound], SEEK_SET); + + int i = 1; + while (_offsets[sound + i] == _offsets[sound]) + i++; + + uint32 size = _offsets[sound + i] - _offsets[sound]; + + _mixer->playFlac(handle, _file, size); +} +#endif + Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::String &gameDataPath, SoundMixer *mixer) : _game(game), _gameDataPath(gameDataPath), _mixer(mixer) { _voice = 0; @@ -259,6 +283,15 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str File *file = new File(); const char *s; +#ifdef USE_FLAC + if (!_voice && gss->flac_filename && gss->flac_filename[0]) { + file->open(gss->flac_filename, gameDataPath); + if (file->isOpen()) { + _voice_file = true; + _voice = new FlacSound(_mixer, file); + } + } +#endif #ifdef USE_MAD if (!_voice && gss->mp3_filename && gss->mp3_filename[0]) { file->open(gss->mp3_filename, gameDataPath); @@ -341,6 +374,14 @@ Sound::Sound(const byte game, const GameSpecificSettings *gss, const Common::Str } } #endif +#ifdef USE_FLAC + if (!_effects && gss->flac_effects_filename && gss->flac_effects_filename[0]) { + file->open(gss->flac_effects_filename, gameDataPath); + if (file->isOpen()) { + _effects = new FlacSound(_mixer, file); + } + } +#endif if (!_effects) { s = gss->voc_effects_filename; file->open(s, gameDataPath); |
