diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sound/midiparser_sci.cpp | 28 | ||||
-rw-r--r-- | engines/sci/sound/midiparser_sci.h | 1 | ||||
-rw-r--r-- | engines/sci/sound/music.cpp | 5 |
3 files changed, 18 insertions, 16 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 1cfaadd36d..61e9d81392 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -81,10 +81,6 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in _channelRemap[9] = 9; // never map channel 9, because that's used for percussion _channelRemap[15] = 15; // never map channel 15, because thats used by sierra internally - // we can't do this later, because otherwise we really send to unmapped channels - if (_pSnd) - setVolume(_pSnd->volume); - if (channelFilterMask) { // SCI0 only has 1 data stream, but we need to filter out channels depending on music hardware selection midiFilterChannels(channelFilterMask); @@ -98,24 +94,28 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in setTrack(0); _loopTick = 0; + return true; +} + +void MidiParser_SCI::sendInitCommands() { if (_pSnd) { if (_soundVersion <= SCI_VERSION_0_LATE) { // Set initial voice count - for (int i = 0; i < 16; ++i) { + for (int i = 0; i < 15; ++i) { byte voiceCount = 0; - if (channelFilterMask & (1 << i)) - voiceCount = psnd->soundRes->getInitialVoiceCount(i); - _driver->send(0xB0 | i, 0x4B, voiceCount); + if (_channelUsed[i]) { + voiceCount = _pSnd->soundRes->getInitialVoiceCount(i); + _driver->send(0xB0 | i, 0x4B, voiceCount); + } } } - - // Send a velocity off signal to all channels - for (int i = 0; i < 16; ++i) { - _driver->send(0xB0 | i, 0x4E, 0); // Reset velocity - } } - return true; + // Send a velocity off signal to all channels + for (int i = 0; i < 15; ++i) { + if (_channelUsed[i]) + sendToDriver(0xB0 | i, 0x4E, 0); // Reset velocity + } } void MidiParser_SCI::unloadMusic() { diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h index 31a3b923fb..48de44555d 100644 --- a/engines/sci/sound/midiparser_sci.h +++ b/engines/sci/sound/midiparser_sci.h @@ -59,6 +59,7 @@ public: bool loadMusic(byte *, uint32) { return false; } + void sendInitCommands(); void unloadMusic(); void setVolume(byte volume); void stop() { diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 8499b6da59..8da0557a31 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -326,9 +326,10 @@ void SciMusic::soundPlay(MusicEntry *pSnd) { if (pSnd->pMidiParser) { pSnd->pMidiParser->tryToOwnChannels(); pSnd->pMidiParser->setVolume(pSnd->volume); - if (pSnd->status == kSoundStopped) + if (pSnd->status == kSoundStopped) { + pSnd->pMidiParser->sendInitCommands(); pSnd->pMidiParser->jumpToTick(0); - else + } else // Fast forward to the last position and perform associated events when loading pSnd->pMidiParser->jumpToTick(pSnd->ticker, true); } |