diff options
author | Martin Kiewitz | 2009-12-28 22:57:43 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-12-28 22:57:43 +0000 |
commit | b65e4a8f749d90b7c5109b5b2cb9e5ac188815c4 (patch) | |
tree | efdf2062b7b005e97fc1b6d7c93cc7426143746d | |
parent | dd1fc9c14bb17d2a599799ed11f124db18b3fad7 (diff) | |
download | scummvm-rg350-b65e4a8f749d90b7c5109b5b2cb9e5ac188815c4.tar.gz scummvm-rg350-b65e4a8f749d90b7c5109b5b2cb9e5ac188815c4.tar.bz2 scummvm-rg350-b65e4a8f749d90b7c5109b5b2cb9e5ac188815c4.zip |
SCI/newmusic: Added pausecounter cause sierra sci also does this
svn-id: r46693
-rw-r--r-- | engines/sci/sfx/music.cpp | 13 | ||||
-rw-r--r-- | engines/sci/sfx/music.h | 3 | ||||
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 4 |
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 } |