diff options
author | Paweł Kołodziejski | 2004-09-18 18:09:35 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-09-18 18:09:35 +0000 |
commit | bdf2a24eb747153a62961b85d128b6c2900a7b5b (patch) | |
tree | e15ed8b9ccf566be868e6dec2ee811122f87db12 | |
parent | 0e9967afe12dd3b095a4f21a3f43d788e08c65a3 (diff) | |
download | scummvm-rg350-bdf2a24eb747153a62961b85d128b6c2900a7b5b.tar.gz scummvm-rg350-bdf2a24eb747153a62961b85d128b6c2900a7b5b.tar.bz2 scummvm-rg350-bdf2a24eb747153a62961b85d128b6c2900a7b5b.zip |
added experimental ogg file support for comi smush audio track
svn-id: r15168
-rw-r--r-- | scumm/smush/smush_player.cpp | 35 | ||||
-rw-r--r-- | scumm/smush/smush_player.h | 4 |
2 files changed, 35 insertions, 4 deletions
diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 0f78768d1e..344ba0127d 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -234,6 +234,7 @@ SmushPlayer::SmushPlayer(ScummEngine_v6 *scumm, int speed) { _subtitles = ConfMan.getBool("subtitles"); _dst = NULL; _storeFrame = false; + _compressedFileMode = false; _width = 0; _height = 0; _IACTpos = 0; @@ -289,7 +290,9 @@ void SmushPlayer::release() { free(_specialBuffer); _specialBuffer = NULL; } - + + _vm->_mixer->stopHandle(_compressedFileSoundHandle); + _vm->_mixer->stopHandle(_IACTchannel); _vm->_fullRedraw = true; @@ -850,7 +853,8 @@ void SmushPlayer::handleFrame(Chunk &b) { break; #endif case TYPE_PSAD: - handleSoundFrame(*sub); + if (!_compressedFileMode) + handleSoundFrame(*sub); break; case TYPE_TRES: handleTextResource(*sub); @@ -862,8 +866,10 @@ void SmushPlayer::handleFrame(Chunk &b) { // FIXME: check parameters if (_insanity) _vm->_insane->procIACT(_dst, 0, 0, 0, *sub, 0, 0); - else - handleIACT(*sub); + else { + if (!_compressedFileMode) + handleIACT(*sub); + } break; case TYPE_STOR: handleStore(*sub); @@ -1113,6 +1119,25 @@ void SmushPlayer::seekSan(const char *file, int32 pos, int32 contFrame) { _frame = contFrame; } +void SmushPlayer::tryOggFile(const char *filename) { + _compressedFileMode = false; + const char *i = strrchr(filename, '.'); + if (i == NULL) { + error("invalid filename : %s", filename); + } + char fname[260]; + memcpy(fname, filename, i - filename); + strcpy(fname + (i - filename), ".ogg"); +#ifdef USE_VORBIS + _compressedFile.open(fname); + if (_compressedFile.isOpen()) { + int size = _compressedFile.size(); + _compressedFileMode = true; + _vm->_mixer->playVorbis(&_compressedFileSoundHandle, &_compressedFile, size); + } +#endif +} + void SmushPlayer::play(const char *filename, int32 offset, int32 startFrame) { // Verify the specified file exists @@ -1124,6 +1149,8 @@ void SmushPlayer::play(const char *filename, int32 offset, int32 startFrame) { } f.close(); + tryOggFile(filename); + _updateNeeded = false; // Hide mouse diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index 8b433ffc37..7b628e5186 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -57,6 +57,9 @@ private: int32 _frame; PlayingSoundHandle _IACTchannel; + PlayingSoundHandle _compressedFileSoundHandle; + bool _compressedFileMode; + File _compressedFile; byte _IACToutput[4096]; int32 _IACTpos; bool _storeFrame; @@ -94,6 +97,7 @@ private: void release(); void setupAnim(const char *file); void updateScreen(); + void tryOggFile(const char *filename); bool readString(const char *file); void checkBlock(const Chunk &, Chunk::type, uint32 = 0); |