diff options
Diffstat (limited to 'scumm/smush/smush_mixer.cpp')
-rw-r--r-- | scumm/smush/smush_mixer.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index c787f3aafc..06ac72e751 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -39,16 +39,19 @@ SmushMixer::SmushMixer(SoundMixer *m) : for (int32 i = 0; i < NUM_CHANNELS; i++) { _channels[i].id = -1; _channels[i].chan = NULL; + _channels[i].stream = NULL; } } SmushMixer::~SmushMixer() { + Common::StackLock lock(_mutex); for (int32 i = 0; i < NUM_CHANNELS; i++) { _mixer->stopHandle(_channels[i].handle); } } SmushChannel *SmushMixer::findChannel(int32 track) { + Common::StackLock lock(_mutex); debugC(DEBUG_SMUSH, "SmushMixer::findChannel(%d)", track); for (int32 i = 0; i < NUM_CHANNELS; i++) { if (_channels[i].id == track) @@ -58,6 +61,7 @@ SmushChannel *SmushMixer::findChannel(int32 track) { } void SmushMixer::addChannel(SmushChannel *c) { + Common::StackLock lock(_mutex); int32 track = c->getTrackIdentifier(); int i; @@ -86,6 +90,7 @@ void SmushMixer::addChannel(SmushChannel *c) { } bool SmushMixer::handleFrame() { + Common::StackLock lock(_mutex); debugC(DEBUG_SMUSH, "SmushMixer::handleFrame()"); for (int i = 0; i < NUM_CHANNELS; i++) { if (_channels[i].id != -1) { @@ -120,7 +125,7 @@ bool SmushMixer::handleFrame() { } if (_mixer->isReady()) { - if (!_mixer->isSoundHandleActive(_channels[i].handle)) { + if (!_channels[i].stream) { _channels[i].stream = makeAppendableAudioStream(rate, flags, 500000); _mixer->playInputStream(SoundMixer::kSFXSoundType, &_channels[i].handle, _channels[i].stream); } @@ -136,6 +141,7 @@ bool SmushMixer::handleFrame() { } bool SmushMixer::stop() { + Common::StackLock lock(_mutex); debugC(DEBUG_SMUSH, "SmushMixer::stop()"); for (int i = 0; i < NUM_CHANNELS; i++) { if (_channels[i].id != -1) { |