[Scummvm-git-logs] scummvm master -> e16ab73cc1c4067ae24b708ff5640931dd77fbfc
bluegr
bluegr at gmail.com
Sat May 23 13:25:48 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e16ab73cc1 SCI: fix bug #11476 (QFG1: Incomplete Music)
Commit: e16ab73cc1c4067ae24b708ff5640931dd77fbfc
https://github.com/scummvm/scummvm/commit/e16ab73cc1c4067ae24b708ff5640931dd77fbfc
Author: athrxx (athrxx at scummvm.org)
Date: 2020-05-23T16:25:43+03:00
Commit Message:
SCI: fix bug #11476 (QFG1: Incomplete Music)
(regression from 3154d57)
Changed paths:
engines/sci/sound/midiparser_sci.cpp
engines/sci/sound/midiparser_sci.h
engines/sci/sound/music.cpp
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index 23fb9946f9..c3b967414d 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -383,6 +383,16 @@ void MidiParser_SCI::resetStateTracking() {
}
}
+void MidiParser_SCI::initTrack() {
+ if (_soundVersion > SCI_VERSION_0_LATE)
+ return;
+ // Send header data to SCI0 sound drivers. The driver function which parses the header (opcode 3)
+ // seems to be implemented at least in all SCI0_LATE drivers. The things that the individual drivers
+ // do in that init function varies.
+ if (_track->header.byteSize())
+ static_cast<MidiPlayer*>(_driver)->initTrack(_track->header);
+}
+
void MidiParser_SCI::sendInitCommands() {
resetStateTracking();
@@ -390,20 +400,12 @@ void MidiParser_SCI::sendInitCommands() {
_volume = 127;
// Set initial voice count
- if (_pSnd) {
- if (_soundVersion <= SCI_VERSION_0_LATE) {
- // Send header data to SCI0 sound drivers. The driver function which parses the header (opcode 3)
- // seems to be implemented at least in all SCI0_LATE drivers. The things that the individual drivers
- // do in that init function varies.
- if (_track->header.byteSize())
- static_cast<MidiPlayer *>(_driver)->initTrack(_track->header);
- } else {
- for (int i = 0; i < _track->channelCount; ++i) {
- byte voiceCount = _track->channels[i].poly;
- byte num = _track->channels[i].number;
- // TODO: Should we skip the control channel?
- sendToDriver(0xB0 | num, 0x4B, voiceCount);
- }
+ if (_pSnd && _soundVersion > SCI_VERSION_0_LATE) {
+ for (int i = 0; i < _track->channelCount; ++i) {
+ byte voiceCount = _track->channels[i].poly;
+ byte num = _track->channels[i].number;
+ // TODO: Should we skip the control channel?
+ sendToDriver(0xB0 | num, 0x4B, voiceCount);
}
}
diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h
index d98c63bd9c..f8a1a01265 100644
--- a/engines/sci/sound/midiparser_sci.h
+++ b/engines/sci/sound/midiparser_sci.h
@@ -60,6 +60,7 @@ public:
bool loadMusic(byte *, uint32) override {
return false;
}
+ void initTrack();
void sendInitCommands();
void unloadMusic() override;
void setMasterVolume(byte masterVolume);
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 5ef9676774..a1b7786496 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -578,6 +578,12 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {
Common::StackLock lock(_mutex);
pSnd->pMidiParser->mainThreadBegin();
+ // The track init always needs to be done. Otherwise some sounds will not be properly set up (bug #11476).
+ // It is also safe to do this for paused tracks, since the jumpToTick() command in line 602 will parse through
+ // the song from the beginning up to the resume position and ensure that the actual current voice mapping,
+ // instrument and volume settings etc. are correct.
+ pSnd->pMidiParser->initTrack();
+
if (pSnd->status != kSoundPaused)
pSnd->pMidiParser->sendInitCommands();
pSnd->pMidiParser->setVolume(pSnd->volume);
More information about the Scummvm-git-logs
mailing list