Skip to content

Commit

Permalink
SCUMM: Clear SFX channel when starting the SFX failed in AD player.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Jun 22, 2014
1 parent ac806a1 commit 5be5f36
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions engines/scumm/players/player_ad.cpp
Expand Up @@ -137,6 +137,18 @@ void Player_AD::startSound(int sound) {
if (startSfx(sfx, res)) {
// Lock the new resource
_vm->_res->lock(rtSound, sound);
} else {
// When starting the sfx failed we need to reset the slot.
sfx->resource = -1;

for (int i = 0; i < ARRAYSIZE(sfx->channels); ++i) {
sfx->channels[i].state = kChannelStateOff;

if (sfx->channels[i].hardwareChannel != -1) {
freeHWChannel(sfx->channels[i].hardwareChannel);
sfx->channels[i].hardwareChannel = -1;
}
}
}
}
}
Expand Down

0 comments on commit 5be5f36

Please sign in to comment.