diff options
author | Johannes Schickel | 2014-06-04 01:49:31 +0200 |
---|---|---|
committer | Johannes Schickel | 2014-06-04 01:49:31 +0200 |
commit | b5ca6b01f9e6748908f5acdcdb08e0dd448e60f1 (patch) | |
tree | 60e75d70df4fb5b1b9d1677ba84a47b73c61b75b /engines | |
parent | ecabacaddd0a89b0aa83c9b176891c5c4f47aafc (diff) | |
download | scummvm-rg350-b5ca6b01f9e6748908f5acdcdb08e0dd448e60f1.tar.gz scummvm-rg350-b5ca6b01f9e6748908f5acdcdb08e0dd448e60f1.tar.bz2 scummvm-rg350-b5ca6b01f9e6748908f5acdcdb08e0dd448e60f1.zip |
SCUMM: Clean up how SFX are stopped in the AD player.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/players/player_ad.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/engines/scumm/players/player_ad.cpp b/engines/scumm/players/player_ad.cpp index fdd62555ff..3f805fe3ae 100644 --- a/engines/scumm/players/player_ad.cpp +++ b/engines/scumm/players/player_ad.cpp @@ -618,11 +618,18 @@ void Player_AD::updateSfx() { continue; } + bool hasActiveChannel = false; for (int j = 0; j < ARRAYSIZE(_sfx[i].channels); ++j) { if (_sfx[i].channels[j].state) { + hasActiveChannel = true; updateChannel(&_sfx[i].channels[j]); } } + + // In case no channel is active we will stop the sfx. + if (!hasActiveChannel) { + stopSfx(&_sfx[i]); + } } } @@ -677,26 +684,14 @@ void Player_AD::parseSlot(Channel *channel) { channel->currentOffset = channel->startOffset; break; - default: { + default: // START OF CHANNEL // When we encounter a start of another channel while playback // it means that the current channel is finished. Thus, we will // stop it. clearChannel(*channel); channel->state = kChannelStateOff; - - // If no channel of the sound effect is playing anymore, unlock - // the resource. - // HACK: We shouldn't rely on the hardware channel to match the - // logical channel... - const int logChannel = channel->hardwareChannel / 3; - if (!_sfx[logChannel].channels[0].state - && !_sfx[logChannel].channels[1].state - && !_sfx[logChannel].channels[2].state) { - stopSfx(&_sfx[logChannel]); - } return; - } } } } |