diff options
author | Paweł Kołodziejski | 2005-01-28 11:59:08 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2005-01-28 11:59:08 +0000 |
commit | 9d64850be203804a8eb9355e707094174a245a45 (patch) | |
tree | 6960e2157f31cf5340ebbd2a43823490a8bb0fa1 /scumm | |
parent | ac06b418946773d49341d9b7ac3404e3ec0998b4 (diff) | |
download | scummvm-rg350-9d64850be203804a8eb9355e707094174a245a45.tar.gz scummvm-rg350-9d64850be203804a8eb9355e707094174a245a45.tar.bz2 scummvm-rg350-9d64850be203804a8eb9355e707094174a245a45.zip |
added support for mp3 compressed tracks
svn-id: r16661
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/smush/smush_player.cpp | 19 | ||||
-rw-r--r-- | scumm/smush/smush_player.h | 2 |
2 files changed, 17 insertions, 4 deletions
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 <png.h> @@ -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); |