aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound
diff options
context:
space:
mode:
authorMartin Kiewitz2010-07-09 14:11:27 +0000
committerMartin Kiewitz2010-07-09 14:11:27 +0000
commitaadf2e976555d08b7f8e773cc4d69882fa1c9d3d (patch)
treed24e85d134b9f7c03addfc0e17df84b4b8e1743e /engines/sci/sound
parentb8933d7e8f1886cc22b0ef8face8ead4e890c3e6 (diff)
downloadscummvm-rg350-aadf2e976555d08b7f8e773cc4d69882fa1c9d3d.tar.gz
scummvm-rg350-aadf2e976555d08b7f8e773cc4d69882fa1c9d3d.tar.bz2
scummvm-rg350-aadf2e976555d08b7f8e773cc4d69882fa1c9d3d.zip
SCI: added currently commented-out pauseSound implementation for some sci0 games, allowing integer for that subfunction
svn-id: r50759
Diffstat (limited to 'engines/sci/sound')
-rw-r--r--engines/sci/sound/music.cpp20
-rw-r--r--engines/sci/sound/music.h1
-rw-r--r--engines/sci/sound/soundcmd.cpp24
3 files changed, 41 insertions, 4 deletions
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 874f0a381e..cf084f81eb 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -166,8 +166,6 @@ void SciMusic::pauseAll(bool pause) {
}
void SciMusic::stopAll() {
- Common::StackLock lock(_mutex);
-
const MusicList::iterator end = _playList.end();
for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
soundStop(*i);
@@ -199,6 +197,24 @@ MusicEntry *SciMusic::getSlot(reg_t obj) {
return NULL;
}
+// We return the currently active music slot for SCI0
+MusicEntry *SciMusic::getActiveSci0MusicSlot() {
+ const MusicList::iterator end = _playList.end();
+ MusicEntry *highestPrioritySlot = NULL;
+ for (MusicList::iterator i = _playList.begin(); i != end; ++i) {
+ MusicEntry *playSlot = *i;
+ if (playSlot->pMidiParser) {
+ if (playSlot->status == kSoundPlaying)
+ return playSlot;
+ if (playSlot->status == kSoundPaused) {
+ if ((!highestPrioritySlot) || (highestPrioritySlot->priority < playSlot->priority))
+ highestPrioritySlot = playSlot;
+ }
+ }
+ }
+ return highestPrioritySlot;
+}
+
void SciMusic::setReverb(byte reverb) {
Common::StackLock lock(_mutex);
_pMidiDrv->setReverb(reverb);
diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index 486848b48f..943a5bd2a8 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -157,6 +157,7 @@ public:
}
MusicEntry *getSlot(reg_t obj);
+ MusicEntry *getActiveSci0MusicSlot();
void pushBackSlot(MusicEntry *slotEntry) {
Common::StackLock lock(_mutex);
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index b1ad11651f..b23aed4745 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -213,8 +213,28 @@ reg_t SoundCommandParser::kDoSoundPause(int argc, reg_t *argv, reg_t acc) {
uint16 value = argc > 1 ? argv[1].toUint16() : 0;
if (!obj.segment) { // pause the whole playlist
- // Pausing/Resuming the whole playlist was introduced in the SCI1 late
- // sound scheme.
+ // SCI0 games (up to including qfg1) give us 0/1 for either resuming or pausing the current music
+ // this one doesn't count, so pausing 2 times and resuming once means here that we are supposed to resume
+ if (_soundVersion <= SCI_VERSION_0_LATE) {
+ // TODO: this code doesn't work right currently
+ return make_reg(0, 0);
+ MusicEntry *musicSlot = _music->getActiveSci0MusicSlot();
+ switch (obj.offset) {
+ case 1:
+ if ((musicSlot) && (musicSlot->status == kSoundPlaying))
+ _music->soundPause(musicSlot);
+ return make_reg(0, 0);
+ case 0:
+ if ((musicSlot) && (musicSlot->status == kSoundPaused))
+ _music->soundResume(musicSlot);
+ return make_reg(0, 1);
+ return make_reg(0, 0);
+ default:
+ error("kDoSoundPause: parameter 0 is invalid for sound-sci0");
+ }
+ }
+
+ // Pausing/Resuming the whole playlist was introduced in the SCI1 late sound scheme.
if (_soundVersion <= SCI_VERSION_1_EARLY)
return acc;