diff options
author | Gregory Montoir | 2007-11-18 20:27:31 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-11-18 20:27:31 +0000 |
commit | c76c6e22567b7b2f89acdf53cb73ed2cf9cac2d3 (patch) | |
tree | baed116dbdea13789a3f563ea225965bf0fec6f1 /engines/queen | |
parent | 9e58b0253d40efb2513755e7f09b17e12fdecdc8 (diff) | |
download | scummvm-rg350-c76c6e22567b7b2f89acdf53cb73ed2cf9cac2d3.tar.gz scummvm-rg350-c76c6e22567b7b2f89acdf53cb73ed2cf9cac2d3.tar.bz2 scummvm-rg350-c76c6e22567b7b2f89acdf53cb73ed2cf9cac2d3.zip |
added rjp1 module specific pattern playback
svn-id: r29559
Diffstat (limited to 'engines/queen')
-rw-r--r-- | engines/queen/sound.cpp | 29 | ||||
-rw-r--r-- | engines/queen/sound.h | 4 |
2 files changed, 22 insertions, 11 deletions
diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index 8b82f715ca..6f7bbc4b2c 100644 --- a/engines/queen/sound.cpp +++ b/engines/queen/sound.cpp @@ -541,7 +541,7 @@ void AmigaSound::updateMusic() { if (_fluteCount > 0 && (_lastOverride == 40 || _lastOverride == 3)) { --_fluteCount; if (_fluteCount == 0) { - playRandomPatternJungle(); + playPattern("JUNG", 5 + _vm->randomizer.getRandomNumber(6)); _fluteCount = 100; } } @@ -564,8 +564,8 @@ void AmigaSound::playSound(const char *base) { } } -void AmigaSound::playModule(const char *base, int song) { - debug(7, "AmigaSound::playModule(%s, %d)", base, song); +Audio::AudioStream *AmigaSound::loadModule(const char *base, int num) { + debug(7, "AmigaSound::loadModule(%s, %d)", base, num); char name[20]; // load song/pattern data @@ -580,20 +580,29 @@ void AmigaSound::playModule(const char *base, int song) { uint8 *insData = _vm->resource()->loadFile(name, 0, &insDataSize); Common::MemoryReadStream insStr(insData, insDataSize); - _mixer->stopHandle(_modHandle); - Audio::AudioStream *stream = Audio::makeRjp1Stream(&sngStr, &insStr, song, _mixer->getOutputRate()); - if (stream) { - _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_modHandle, stream); - } + Audio::AudioStream *stream = Audio::makeRjp1Stream(&sngStr, &insStr, num, _mixer->getOutputRate()); delete[] sngData; delete[] insData; + return stream; +} + +void AmigaSound::playModule(const char *base, int song) { + _mixer->stopHandle(_modHandle); + Audio::AudioStream *stream = loadModule(base, song); + if (stream) { + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_modHandle, stream); + } _fanfareCount = 0; } -void AmigaSound::playRandomPatternJungle() { - // XXX pickup a pattern (songData[4],songData[6]) between 5 and 11 from JUNG.SNG and play it +void AmigaSound::playPattern(const char *base, int pattern) { + _mixer->stopHandle(_patHandle); + Audio::AudioStream *stream = loadModule(base, -pattern); + if (stream) { + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_patHandle, stream); + } } bool AmigaSound::playSpecialSfx(int16 sfx) { diff --git a/engines/queen/sound.h b/engines/queen/sound.h index 3906167193..e2a279c09b 100644 --- a/engines/queen/sound.h +++ b/engines/queen/sound.h @@ -170,13 +170,15 @@ public: protected: void playSound(const char *base); + Audio::AudioStream *loadModule(const char *base, int song); void playModule(const char *base, int song); - void playRandomPatternJungle(); + void playPattern(const char *base, int pattern); bool playSpecialSfx(int16 sfx); int16 _fanfareRestore; int _fanfareCount, _fluteCount; Audio::SoundHandle _modHandle; + Audio::SoundHandle _patHandle; Audio::SoundHandle _sfxHandle; }; |