aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/sound')
-rw-r--r--engines/sci/sound/midiparser_sci.cpp40
-rw-r--r--engines/sci/sound/music.cpp8
-rw-r--r--engines/sci/sound/music.h1
3 files changed, 32 insertions, 17 deletions
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index 9653d9ccff..7640c5f314 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -440,7 +440,7 @@ void MidiParser_SCI::sendToDriver(uint32 midi) {
}
void MidiParser_SCI::parseNextEvent(EventInfo &info) {
- // Set signal AFTER waiting for delta, otherwise we would set signal too soon resulting in all sorts of bugs
+ // Set signal AFTER waiting for delta, otherwise we would set signal too soon resulting in all sorts of bugs
if (_dataincAdd) {
_dataincAdd = false;
_pSnd->dataInc += _dataincToAdd;
@@ -455,7 +455,9 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
}
if (_jumpToHoldTick) {
_jumpToHoldTick = false;
+ _pSnd->inFastForward = true;
jumpToTick(_loopTick, false, false);
+ _pSnd->inFastForward = false;
}
info.start = _position._playPos;
@@ -497,8 +499,10 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
// immediately there.
if (_soundVersion <= SCI_VERSION_0_LATE ||
_position._playTick || info.delta) {
- _signalSet = true;
- _signalToSet = info.basic.param1;
+ if (!_pSnd->inFastForward) {
+ _signalSet = true;
+ _signalToSet = info.basic.param1;
+ }
}
} else {
_loopTick = _position._playTick + info.delta;
@@ -552,19 +556,21 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
}
break;
case kUpdateCue:
- _dataincAdd = true;
- switch (_soundVersion) {
- case SCI_VERSION_0_EARLY:
- case SCI_VERSION_0_LATE:
- _dataincToAdd = info.basic.param2;
- break;
- case SCI_VERSION_1_EARLY:
- case SCI_VERSION_1_LATE:
- case SCI_VERSION_2_1:
- _dataincToAdd = 1;
- break;
- default:
- error("unsupported _soundVersion");
+ if (!_pSnd->inFastForward) {
+ _dataincAdd = true;
+ switch (_soundVersion) {
+ case SCI_VERSION_0_EARLY:
+ case SCI_VERSION_0_LATE:
+ _dataincToAdd = info.basic.param2;
+ break;
+ case SCI_VERSION_1_EARLY:
+ case SCI_VERSION_1_LATE:
+ case SCI_VERSION_2_1:
+ _dataincToAdd = 1;
+ break;
+ default:
+ error("unsupported _soundVersion");
+ }
}
break;
case kResetOnPause:
@@ -660,7 +666,9 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
assert(_loopTick + info.delta < _position._playTick);
uint32 extraDelta = info.delta;
+ _pSnd->inFastForward = true;
jumpToTick(_loopTick);
+ _pSnd->inFastForward = false;
_nextEvent.delta += extraDelta;
} else {
_pSnd->status = kSoundStopped;
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 913ba32cba..1628a22386 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -519,9 +519,14 @@ void SciMusic::soundPlay(MusicEntry *pSnd) {
if (pSnd->status == kSoundStopped)
pSnd->pMidiParser->jumpToTick(0);
- else
+ else {
// Fast forward to the last position and perform associated events when loading
+ pSnd->inFastForward = true;
+ // we set this flag, so that the midiparser doesn't set any signals for scripts
+ // if we don't do this, at least accessing the debugger will reset previously set signals
pSnd->pMidiParser->jumpToTick(pSnd->ticker, true, true, true);
+ pSnd->inFastForward = false;
+ }
// Restore looping and hold
pSnd->loop = prevLoop;
@@ -760,6 +765,7 @@ MusicEntry::MusicEntry() {
resourceId = 0;
isQueued = false;
+ inFastForward = false;
dataInc = 0;
ticker = 0;
diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index 1f798c90d7..5924a0fd12 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -65,6 +65,7 @@ public:
uint16 resourceId;
bool isQueued; // for SCI0 only!
+ bool inFastForward; // if we are currently fast-forwarding (disables any signals to scripts)
uint16 dataInc;
uint16 ticker;