aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFlorian Kagerer2010-10-08 16:31:08 +0000
committerFlorian Kagerer2010-10-08 16:31:08 +0000
commitb58bbd719cad79445f496828f1a49465481826ee (patch)
tree31f53331361f3270d2402f24bb172dd19e773c82 /engines
parent4ad65e5179c4ad5bf71d2bba3eaaeebf9fcef211 (diff)
downloadscummvm-rg350-b58bbd719cad79445f496828f1a49465481826ee.tar.gz
scummvm-rg350-b58bbd719cad79445f496828f1a49465481826ee.tar.bz2
scummvm-rg350-b58bbd719cad79445f496828f1a49465481826ee.zip
SCUMM/FM-TOWNS: fixed threading issue in sfx code
svn-id: r53074
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/player_towns.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/engines/scumm/player_towns.cpp b/engines/scumm/player_towns.cpp
index fa19cb20fd..ee4caeaec1 100644
--- a/engines/scumm/player_towns.cpp
+++ b/engines/scumm/player_towns.cpp
@@ -164,7 +164,7 @@ int Player_Towns::allocatePcmChannel(int sound, int sfxChanRelIndex, uint32 prio
if (_v2 && priority > 255) {
chan = 8;
- if (_intf->callback(40, 0x47))
+ if (_intf->callback(40, 0x47) && _pcmCurrentSound[chan].index != 0xffff)
_vm->_sound->stopSound(_pcmCurrentSound[chan].index);
} else {
for (int i = 8; i; i--) {
@@ -218,8 +218,8 @@ Player_Towns_v1::Player_Towns_v1(ScummEngine *vm, Audio::Mixer *mixer) : Player_
}
Player_Towns_v1::~Player_Towns_v1() {
- delete[] _soundOverride;
delete _driver;
+ delete[] _soundOverride;
}
bool Player_Towns_v1::init() {
@@ -590,11 +590,13 @@ Player_Towns_v2::Player_Towns_v2(ScummEngine *vm, IMuse *imuse, Audio::Mixer *mi
}
Player_Towns_v2::~Player_Towns_v2() {
- delete[] _sblData;
- delete[] _soundOverride;
delete _intf;
+
if (_imuseDispose)
delete _imuse;
+
+ delete[] _sblData;
+ delete[] _soundOverride;
}
bool Player_Towns_v2::init() {
@@ -725,6 +727,8 @@ void Player_Towns_v2::playPcmTrackSBL(const uint8 *data) {
uint32 len = (READ_LE_UINT32(data) >> 8) - 2;
int chan = allocatePcmChannel(0xffff, 0, 0x1000);
+ if (!chan)
+ return;
delete[] _sblData;
_sblData = new uint8[len + 32];