From 9d64850be203804a8eb9355e707094174a245a45 Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Fri, 28 Jan 2005 11:59:08 +0000 Subject: added support for mp3 compressed tracks svn-id: r16661 --- scumm/smush/smush_player.cpp | 19 ++++++++++++++++--- scumm/smush/smush_player.h | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'scumm') diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 95982f83c4..162b87ee95 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -45,6 +45,7 @@ #include "sound/mixer.h" #include "sound/vorbis.h" +#include "sound/mp3.h" #ifdef DUMP_SMUSH_FRAMES #include @@ -1172,21 +1173,33 @@ void SmushPlayer::seekSan(const char *file, int32 pos, int32 contFrame) { _frame = contFrame; } -void SmushPlayer::tryOggFile(const char *filename) { +void SmushPlayer::tryCmpFile(const char *filename) { _compressedFileMode = false; const char *i = strrchr(filename, '.'); if (i == NULL) { error("invalid filename : %s", filename); } char fname[260]; +#ifdef USE_MAD memcpy(fname, filename, i - filename); - strcpy(fname + (i - filename), ".ogg"); + strcpy(fname + (i - filename), ".mp3"); + _compressedFile.open(fname); + if (_compressedFile.isOpen()) { + int size = _compressedFile.size(); + _compressedFileMode = true; + _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size)); + return; + } +#endif #ifdef USE_VORBIS + memcpy(fname, filename, i - filename); + strcpy(fname + (i - filename), ".ogg"); _compressedFile.open(fname); if (_compressedFile.isOpen()) { int size = _compressedFile.size(); _compressedFileMode = true; _vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size)); + return; } #endif } @@ -1202,7 +1215,7 @@ void SmushPlayer::play(const char *filename, int32 offset, int32 startFrame) { } f.close(); - tryOggFile(filename); + tryCmpFile(filename); _updateNeeded = false; diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index 4238e0f053..9eb3031af0 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -104,7 +104,7 @@ private: void release(); void setupAnim(const char *file); void updateScreen(); - void tryOggFile(const char *filename); + void tryCmpFile(const char *filename); bool readString(const char *file); void checkBlock(const Chunk &, Chunk::type, uint32 = 0); -- cgit v1.2.3