aboutsummaryrefslogtreecommitdiff
path: root/scumm/smush/smush_mixer.cpp
diff options
context:
space:
mode:
authorMax Horn2005-04-04 18:42:35 +0000
committerMax Horn2005-04-04 18:42:35 +0000
commit581ab2ed638663c67ffd7ac08e314be603de2c8e (patch)
tree1a67bb120698895c2ea4099e1960f20749a18554 /scumm/smush/smush_mixer.cpp
parentadf9bcf5d1c2efdb57ebf01f06dc4457122c512c (diff)
downloadscummvm-rg350-581ab2ed638663c67ffd7ac08e314be603de2c8e.tar.gz
scummvm-rg350-581ab2ed638663c67ffd7ac08e314be603de2c8e.tar.bz2
scummvm-rg350-581ab2ed638663c67ffd7ac08e314be603de2c8e.zip
Got rid of isSoundHandleActive usage; made the SmushMixer thread safe
svn-id: r17380
Diffstat (limited to 'scumm/smush/smush_mixer.cpp')
-rw-r--r--scumm/smush/smush_mixer.cpp8
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) {