diff options
author | Travis Howell | 2009-03-15 06:07:57 +0000 |
---|---|---|
committer | Travis Howell | 2009-03-15 06:07:57 +0000 |
commit | a6497584cc6601f56a861183365bb96cfd519a7b (patch) | |
tree | f299eec955c01b767cc92aa02cdc61686e1589b8 | |
parent | f903e32c51d8cad2304e1c0651f5b337cf4f69ab (diff) | |
download | scummvm-rg350-a6497584cc6601f56a861183365bb96cfd519a7b.tar.gz scummvm-rg350-a6497584cc6601f56a861183365bb96cfd519a7b.tar.bz2 scummvm-rg350-a6497584cc6601f56a861183365bb96cfd519a7b.zip |
Enable music in Amiga version of BRA too.
svn-id: r39409
-rw-r--r-- | engines/parallaction/disk_br.cpp | 29 | ||||
-rw-r--r-- | engines/parallaction/parallaction_br.cpp | 1 | ||||
-rw-r--r-- | engines/parallaction/sound.h | 16 | ||||
-rw-r--r-- | engines/parallaction/sound_br.cpp | 41 |
4 files changed, 70 insertions, 17 deletions
diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index cd98106f54..6ed57f0f50 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -480,23 +480,18 @@ void AmigaDisk_br::loadScenery(BackgroundInfo& info, const char* name, const cha delete stream; } #if 0 - if (mask && _mskDir.exists()) { - filepath = Common::String(mask) + ".msk"; - node = _mskDir.getChild(filepath); - if (!node.exists()) { - filepath = Common::String(mask) + ".msk"; - node = _commonMskDir.getChild(filepath); - } - - if (node.exists()) { - stream.open(node); - stream.seek(0x30, SEEK_SET); - Graphics::PackBitsReadStream unpackedStream(stream); - info.mask.create(info.width, info.height); - unpackedStream.read(info.mask.data, info.mask.size); + if (mask) { + stream = tryOpenFile("msk/" + Common::String(path), ".msk"); + if (stream) { + Graphics::PackBitsReadStream unpackedStream(*stream); + info._mask = new MaskBuffer; + info._mask->create(info.width, info.height); + unpackedStream.read(info._mask->data, info._mask->size); // TODO: there is another step to do after decompression... - loadMask(info, stream); - stream.close(); + loadMask(mask, *info._mask); + delete stream; + } else { + debugC(1, kDebugDisk, "AmigaDisk_br::loadScenery: (%s) not found", mask); } } #endif @@ -603,7 +598,7 @@ Font* AmigaDisk_br::loadFont(const char* name) { Common::SeekableReadStream* AmigaDisk_br::loadMusic(const char* name) { debugC(5, kDebugDisk, "AmigaDisk_br::loadMusic"); - return openFile("msc/" + Common::String(name), ".msc"); + return tryOpenFile("msc/" + Common::String(name), ".msc"); } diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index 28a36db6cd..190df55466 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -66,6 +66,7 @@ Common::Error Parallaction_br::init() { } else { _disk = new AmigaDisk_br(this); _disk->setLanguage(2); // NOTE: language is now hardcoded to English. Original used command-line parameters. + _soundManI = new AmigaSoundMan_br(this); } _disk->init(); diff --git a/engines/parallaction/sound.h b/engines/parallaction/sound.h index 57e86ce159..087e00fdaa 100644 --- a/engines/parallaction/sound.h +++ b/engines/parallaction/sound.h @@ -182,6 +182,8 @@ public: class SoundMan_br : public SoundManImpl { protected: + Audio::Mixer *_mixer; + Common::String _musicFile; virtual void playMusic() = 0; @@ -206,6 +208,20 @@ public: void pause(bool p); }; +class AmigaSoundMan_br : public SoundMan_br { + + Audio::AudioStream *_musicStream; + Audio::SoundHandle _musicHandle; + +public: + AmigaSoundMan_br(Parallaction_br *vm); + ~AmigaSoundMan_br(); + + void playMusic(); + void stopMusic(); + void pause(bool p); +}; + } // namespace Parallaction #endif diff --git a/engines/parallaction/sound_br.cpp b/engines/parallaction/sound_br.cpp index e2c01520f9..269ab0d7cb 100644 --- a/engines/parallaction/sound_br.cpp +++ b/engines/parallaction/sound_br.cpp @@ -26,8 +26,11 @@ #include "sound/mixer.h" #include "common/stream.h" #include "common/util.h" + +#include "sound/mixer.h" #include "sound/mididrv.h" #include "sound/midiparser.h" +#include "sound/mods/protracker.h" #include "parallaction/disk.h" #include "parallaction/parallaction.h" @@ -416,6 +419,44 @@ void DosSoundMan_br::pause(bool p) { _midiPlayer->pause(p); } +AmigaSoundMan_br::AmigaSoundMan_br(Parallaction_br *vm) { + _musicStream = 0; +} + +AmigaSoundMan_br::~AmigaSoundMan_br() { +} + +void AmigaSoundMan_br::playMusic() { + stopMusic(); + + debugC(1, kDebugAudio, "AmigaSoundMan_ns::playMusic()"); + + Common::SeekableReadStream *stream = _vm->_disk->loadMusic(_musicFile.c_str()); + if (!stream) + return; + + _musicStream = Audio::makeProtrackerStream(stream); + delete stream; + + debugC(3, kDebugAudio, "AmigaSoundMan_ns::playMusic(): created new music stream"); + + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, _musicStream, -1, 255, 0, false, false); +} + +void AmigaSoundMan_br::stopMusic() { + debugC(1, kDebugAudio, "AmigaSoundMan_ns::stopMusic()"); + + if (_mixer->isSoundHandleActive(_musicHandle)) { + _mixer->stopHandle(_musicHandle); + delete _musicStream; + _musicStream = 0; + } +} + +void AmigaSoundMan_br::pause(bool p) { + _mixer->pauseHandle(_musicHandle, p); +} + void SoundMan_br::setMusicFile(const char *name) { _musicFile = name; } |