aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2003-05-23 16:47:45 +0000
committerMax Horn2003-05-23 16:47:45 +0000
commit0439e0fe5873f746e6dd7f942d9a6be1a209db30 (patch)
treea981bed8e0aa694cd897bdad595d3cab0e636d8d /sound
parent8feba0dfaffc86140e03e2c6f8e633d3f74c9a33 (diff)
downloadscummvm-rg350-0439e0fe5873f746e6dd7f942d9a6be1a209db30.tar.gz
scummvm-rg350-0439e0fe5873f746e6dd7f942d9a6be1a209db30.tar.bz2
scummvm-rg350-0439e0fe5873f746e6dd7f942d9a6be1a209db30.zip
fixed nasty deadlock I recently introduced
svn-id: r7867
Diffstat (limited to 'sound')
-rw-r--r--sound/mixer.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 769a1254ed..957b4bd0ed 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -153,26 +153,25 @@ int SoundMixer::playVorbis(PlayingSoundHandle *handle, OggVorbis_File *ov_file,
void SoundMixer::mix(int16 *buf, uint len) {
_syst->lock_mutex(_mutex);
- if (_paused) {
- memset(buf, 0, 2 * len * sizeof(int16));
- return;
- }
-
- if (_premixProc) {
+
+ if (_premixProc && !_paused) {
int i;
_premixProc(_premixParam, buf, len);
for (i = (len - 1); i >= 0; i--) {
buf[2 * i] = buf[2 * i + 1] = buf[i];
}
} else {
- // no premixer available, zero the buf out
+ // zero the buf out
memset(buf, 0, 2 * len * sizeof(int16));
}
- /* now mix all channels */
- for (int i = 0; i != NUM_CHANNELS; i++)
- if (_channels[i])
- _channels[i]->mix(buf, len);
+ if (!_paused) {
+ /* now mix all channels */
+ for (int i = 0; i != NUM_CHANNELS; i++)
+ if (_channels[i])
+ _channels[i]->mix(buf, len);
+ }
+
_syst->unlock_mutex(_mutex);
}