diff options
author | Martin Kiewitz | 2009-12-24 17:40:45 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-12-24 17:40:45 +0000 |
commit | d7cd8345c0ea2688101b3a0d059f6dc7ae45abd6 (patch) | |
tree | a6812a1b59772121b735efb77d067f01f5ebec77 /engines | |
parent | 7867716b6e5619a9df57430d585a909b8bf70e0b (diff) | |
download | scummvm-rg350-d7cd8345c0ea2688101b3a0d059f6dc7ae45abd6.tar.gz scummvm-rg350-d7cd8345c0ea2688101b3a0d059f6dc7ae45abd6.tar.bz2 scummvm-rg350-d7cd8345c0ea2688101b3a0d059f6dc7ae45abd6.zip |
SCI: new music code / signals now almost correctly triggered
svn-id: r46532
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sfx/music.cpp | 31 | ||||
-rw-r--r-- | engines/sci/sfx/music.h | 8 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 3 |
3 files changed, 28 insertions, 14 deletions
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 105e23d05c..cfd38dfdcc 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -41,8 +41,8 @@ static int f_compare(const void *arg1, const void *arg2) { return ((const MusicEntry *)arg2)->prio - ((const MusicEntry *)arg1)->prio; } -SciMusic::SciMusic() { - +SciMusic::SciMusic(SciVersion soundVersion) + : _soundVersion(soundVersion) { } SciMusic::~SciMusic() { @@ -334,7 +334,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { } // Find out what channels to filter for SCI0 channelFilterMask = pSnd->soundRes->getChannelFilterMask(_pMidiDrv->getPlayMask()); - pSnd->pMidiParser->loadMusic(track, pSnd, channelFilterMask); + pSnd->pMidiParser->loadMusic(track, pSnd, channelFilterMask, _soundVersion); } } @@ -496,10 +496,12 @@ MidiParser_SCI::~MidiParser_SCI() { unloadMusic(); } //--------------------------------------------- -bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, int channelFilterMask) { +bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, int channelFilterMask, SciVersion soundVersion) { unloadMusic(); _track = track; _pSnd = psnd; + _soundVersion = soundVersion; + setVolume(psnd->volume); if (channelFilterMask) { @@ -546,10 +548,11 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { info.basic.param1 = *(_position._play_pos++); info.basic.param2 = 0; if (info.channel() == 0xF) {// SCI special case - if (info.basic.param1 != 0x7F) + if (info.basic.param1 != 0x7F) { PUT_SEL32V(segMan, _pSnd->soundObj, signal, info.basic.param1); - else + } else { _loopTick = _position._play_tick; + } } break; case 0xD: @@ -561,8 +564,18 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { info.basic.param1 = *(_position._play_pos++); info.basic.param2 = *(_position._play_pos++); if (info.channel() == 0xF) {// SCI special - if (info.basic.param1 == 0x60) - _pSnd->dataInc++; + if (info.basic.param1 == 0x60) { + switch (_soundVersion) { + case SCI_VERSION_0_EARLY: + _pSnd->dataInc += info.basic.param2; + PUT_SEL32V(segMan, _pSnd->soundObj, signal, 0x7f + _pSnd->dataInc); + break; + case SCI_VERSION_1_EARLY: + case SCI_VERSION_1_LATE: + _pSnd->dataInc++; + break; + } + } // BF 50 x - set reverb to x // BF 60 x - dataInc++ // BF 52 x - bHold=x @@ -747,8 +760,6 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) { _mixedData = filterData; lastCommand = 0; - // Find out which channels to filter out - while (channelData <= channelDataEnd) { delta += *channelData++; curByte = *channelData++; diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index ccaad506b5..4050f008bc 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -97,7 +97,7 @@ struct MusicEntry { class SciMusic { public: - SciMusic(); + SciMusic(SciVersion soundVersion); ~SciMusic(); void init(); @@ -148,6 +148,8 @@ protected: void doFade(MusicEntry *pSnd); + SciVersion _soundVersion; + Audio::Mixer *_pMixer; MidiPlayer *_pMidiDrv; MidiDriverType _midiType; @@ -163,7 +165,7 @@ class MidiParser_SCI : public MidiParser { public: MidiParser_SCI(); ~MidiParser_SCI(); - bool loadMusic(SoundResource::Track *track, MusicEntry *psnd, int channelFilterMask); + bool loadMusic(SoundResource::Track *track, MusicEntry *psnd, int channelFilterMask, SciVersion soundVersion); bool loadMusic(byte *, uint32) { return false; } @@ -181,6 +183,8 @@ protected: byte *midiMixChannels(); byte *midiFilterChannels(int channelMask); byte midiGetNextChannel(long ticker); + + SciVersion _soundVersion; byte *_mixedData; SoundResource::Track *_track; MusicEntry *_pSnd; diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index 3c8c892127..553e6e4915 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -136,7 +136,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM _hasNodePtr = (((SciEngine*)g_engine)->getKernel()->_selectorCache.nodePtr != -1); #ifndef USE_OLD_MUSIC_FUNCTIONS - _music = new SciMusic(); + _music = new SciMusic(_doSoundVersion); _music->init(); #endif @@ -674,7 +674,6 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { case SI_ABSOLUTE_CUE: debugC(2, kDebugLevelSound, "--- [CUE] %04x:%04x Absolute Cue: %d\n", PRINT_REG(obj), signal); - PUT_SEL32V(_segMan, obj, signal, signal); break; |