aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2010-01-02 13:04:36 +0000
committerFilippos Karapetis2010-01-02 13:04:36 +0000
commitd4dda4df831e3772d2ed5c134bafb2ae07c3eb47 (patch)
treeb85bd81268aee4ad74c4295ef78c5898ec0d01b3 /engines/sci
parentaaf66f20ef909122635da248c0eecb122cca5902 (diff)
downloadscummvm-rg350-d4dda4df831e3772d2ed5c134bafb2ae07c3eb47.tar.gz
scummvm-rg350-d4dda4df831e3772d2ed5c134bafb2ae07c3eb47.tar.bz2
scummvm-rg350-d4dda4df831e3772d2ed5c134bafb2ae07c3eb47.zip
SCI/new music code: Implemented cmdSetSoundHold. Larry now exits the limo normally in LSL5
svn-id: r46880
Diffstat (limited to 'engines/sci')
-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
}