aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sfx/midiparser.h6
-rw-r--r--engines/sci/sfx/music.cpp7
-rw-r--r--engines/sci/sfx/music.h1
-rw-r--r--engines/sci/sfx/soundcmd.cpp9
4 files changed, 20 insertions, 3 deletions
diff --git a/engines/sci/sfx/midiparser.h b/engines/sci/sfx/midiparser.h
index 7f4945fdcf..3491ec0ea6 100644
--- a/engines/sci/sfx/midiparser.h
+++ b/engines/sci/sfx/midiparser.h
@@ -63,6 +63,12 @@ public:
allNotesOff();
}
+ void hangAllnotes(byte value) {
+ if (value)
+ hangAllActiveNotes();
+ else
+ allNotesOff();
+ }
protected:
void parseNextEvent(EventInfo &info);
byte *midiMixChannels();
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp
index 1a98a58a02..e1ddc04668 100644
--- a/engines/sci/sfx/music.cpp
+++ b/engines/sci/sfx/music.cpp
@@ -433,6 +433,13 @@ void SciMusic::soundSetPriority(MusicEntry *pSnd, byte prio) {
sortPlayList();
}
+void SciMusic::soundSetHold(MusicEntry *pSnd, byte hold) {
+ Common::StackLock lock(_mutex);
+
+ pSnd->hold = hold;
+ pSnd->pMidiParser->hangAllnotes(hold);
+}
+
void SciMusic::soundKill(MusicEntry *pSnd) {
pSnd->status = kSoundStopped;
diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h
index 6087202cb0..f38987017e 100644
--- a/engines/sci/sfx/music.h
+++ b/engines/sci/sfx/music.h
@@ -146,6 +146,7 @@ public:
void soundResume(MusicEntry *pSnd);
void soundSetVolume(MusicEntry *pSnd, byte volume);
void soundSetPriority(MusicEntry *pSnd, byte prio);
+ void soundSetHold(MusicEntry *pSnd, byte hold);
uint16 soundGetMasterVolume();
void soundSetMasterVolume(uint16 vol);
uint16 soundGetSoundOn() const { return _soundOn; }
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index beddedef8c..76b7e68e00 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -857,9 +857,12 @@ void SoundCommandParser::cmdSetSoundHold(reg_t obj, int16 value) {
return;
}
- musicSlot->hold = value;
-
- // TODO: actually handle channel hold!
+ // Hold the sound before it ends for the specified amount of time. The
+ // engine will signal when to stop it, by setting hold to 0, in which
+ // case stop the sound
+ _music->soundSetHold(musicSlot, value);
+ if (!value)
+ cmdStopSound(obj, 0);
#endif
}