diff options
author | Johannes Schickel | 2014-06-04 01:49:31 +0200 |
---|---|---|
committer | Johannes Schickel | 2014-06-04 01:49:31 +0200 |
commit | 707cfd07ac373dd30e71bb33d3dec8c1d14a386c (patch) | |
tree | 15b58b2adb0e639747209108422443e5948297c8 /engines/scumm | |
parent | a6ec34f4242ebb4cc3e0795e4186729302b43b9c (diff) | |
download | scummvm-rg350-707cfd07ac373dd30e71bb33d3dec8c1d14a386c.tar.gz scummvm-rg350-707cfd07ac373dd30e71bb33d3dec8c1d14a386c.tar.bz2 scummvm-rg350-707cfd07ac373dd30e71bb33d3dec8c1d14a386c.zip |
SCUMM: Only stop music when requested in AD code.
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/players/player_ad.cpp | 39 | ||||
-rw-r--r-- | engines/scumm/players/player_ad.h | 1 |
2 files changed, 24 insertions, 16 deletions
diff --git a/engines/scumm/players/player_ad.cpp b/engines/scumm/players/player_ad.cpp index 6083283de5..dfd4d7f131 100644 --- a/engines/scumm/players/player_ad.cpp +++ b/engines/scumm/players/player_ad.cpp @@ -147,7 +147,7 @@ void Player_AD::stopSound(int sound) { Common::StackLock lock(_mutex); if (sound == _soundPlaying) { - stopAllSounds(); + stopMusic(); } else { for (int i = 0; i < ARRAYSIZE(_sfx); ++i) { if (_sfx[i].resource == sound) { @@ -160,21 +160,8 @@ void Player_AD::stopSound(int sound) { void Player_AD::stopAllSounds() { Common::StackLock lock(_mutex); - // Unlock the music resource if present - if (_soundPlaying != -1) { - _vm->_res->unlock(rtSound, _soundPlaying); - _soundPlaying = -1; - } - - // Stop the music playback - _curOffset = 0; - - // Stop all music voice channels - for (int i = 0; i < ARRAYSIZE(_voiceChannels); ++i) { - if (_voiceChannels[i].lastEvent) { - noteOff(i); - } - } + // Stop the music + stopMusic(); // Stop all the sfx playback for (int i = 0; i < ARRAYSIZE(_sfx); ++i) { @@ -384,6 +371,26 @@ void Player_AD::startMusic() { _musicLoopStart = READ_LE_UINT16(_musicData + 5); } +void Player_AD::stopMusic() { + if (_soundPlaying == -1) { + return; + } + + // Unlock the music resource if present + _vm->_res->unlock(rtSound, _soundPlaying); + _soundPlaying = -1; + + // Stop the music playback + _curOffset = 0; + + // Stop all music voice channels + for (int i = 0; i < ARRAYSIZE(_voiceChannels); ++i) { + if (_voiceChannels[i].lastEvent) { + noteOff(i); + } + } +} + void Player_AD::updateMusic() { _musicTimer += _musicTicks; if (_musicTimer < _timerLimit) { diff --git a/engines/scumm/players/player_ad.h b/engines/scumm/players/player_ad.h index f8504c4473..fbf604e3f8 100644 --- a/engines/scumm/players/player_ad.h +++ b/engines/scumm/players/player_ad.h @@ -105,6 +105,7 @@ private: // Music handling void startMusic(); + void stopMusic(); void updateMusic(); void noteOff(uint channel); void setupFrequency(uint channel, int8 frequency); |