From 5be5f36aa90ecb09cde5a3d207860906bb6975f6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 22 Jun 2014 14:53:38 +0200 Subject: SCUMM: Clear SFX channel when starting the SFX failed in AD player. --- engines/scumm/players/player_ad.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'engines/scumm') diff --git a/engines/scumm/players/player_ad.cpp b/engines/scumm/players/player_ad.cpp index 1176a62112..2d8de3a862 100644 --- a/engines/scumm/players/player_ad.cpp +++ b/engines/scumm/players/player_ad.cpp @@ -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; + } + } } } } -- cgit v1.2.3