aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/sfx/music.cpp13
-rw-r--r--engines/sci/sfx/music.h3
-rw-r--r--engines/sci/sfx/soundcmd.cpp4
3 files changed, 18 insertions, 2 deletions
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp
index 102ef57372..9d002da929 100644
--- a/engines/sci/sfx/music.cpp
+++ b/engines/sci/sfx/music.cpp
@@ -448,6 +448,9 @@ void SciMusic::soundKill(MusicEntry *pSnd) {
}
void SciMusic::soundPause(MusicEntry *pSnd) {
+ pSnd->pauseCounter++;
+ if (pSnd->status == kSoundPaused)
+ return;
pSnd->status = kSoundPaused;
if (pSnd->pStreamAud)
_pMixer->pauseHandle(pSnd->hCurrentAud, true);
@@ -455,6 +458,14 @@ void SciMusic::soundPause(MusicEntry *pSnd) {
pSnd->pMidiParser->pause();
}
+void SciMusic::soundResume(MusicEntry *pSnd) {
+ pSnd->pauseCounter--;
+ if (pSnd->pauseCounter != 0)
+ return;
+ if (pSnd->status != kSoundPaused)
+ return;
+ soundPlay(pSnd);
+}
uint16 SciMusic::soundGetMasterVolume() {
return (_pMixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 8) * 0xF / Audio::Mixer::kMaxMixerVolume;
@@ -527,6 +538,8 @@ MusicEntry::MusicEntry() {
loop = 0;
volume = 0;
+ pauseCounter = 0;
+
fadeTo = 0;
fadeStep = 0;
fadeTicker = 0;
diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h
index ddb67aaf51..0c648aac25 100644
--- a/engines/sci/sfx/music.h
+++ b/engines/sci/sfx/music.h
@@ -75,6 +75,8 @@ public:
byte loop;
int16 volume;
+ int16 pauseCounter;
+
byte fadeTo;
short fadeStep;
uint32 fadeTicker;
@@ -127,6 +129,7 @@ public:
void soundStop(MusicEntry *pSnd);
void soundKill(MusicEntry *pSnd);
void soundPause(MusicEntry *pSnd);
+ void soundResume(MusicEntry *pSnd);
void soundSetVolume(MusicEntry *pSnd, byte volume);
void soundSetPriority(MusicEntry *pSnd, byte prio);
uint16 soundGetMasterVolume();
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp
index 433ab38c3c..3f2308b736 100644
--- a/engines/sci/sfx/soundcmd.cpp
+++ b/engines/sci/sfx/soundcmd.cpp
@@ -538,7 +538,7 @@ void SoundCommandParser::cmdPauseHandle(reg_t obj, int16 value) {
if (value)
_music->soundPause(musicSlot);
else
- _music->soundPlay(musicSlot);
+ _music->soundResume(musicSlot);
}
if (slotLoop) {
slotLoop = _music->enumPlayList(slotLoop);
@@ -565,7 +565,7 @@ void SoundCommandParser::cmdResumeHandle(reg_t obj, int16 value) {
}
PUT_SEL32V(_segMan, obj, state, kSoundPlaying);
- _music->soundPlay(musicSlot);
+ _music->soundResume(musicSlot);
#endif
}