diff options
author | Max Horn | 2003-05-23 16:47:45 +0000 |
---|---|---|
committer | Max Horn | 2003-05-23 16:47:45 +0000 |
commit | 0439e0fe5873f746e6dd7f942d9a6be1a209db30 (patch) | |
tree | a981bed8e0aa694cd897bdad595d3cab0e636d8d | |
parent | 8feba0dfaffc86140e03e2c6f8e633d3f74c9a33 (diff) | |
download | scummvm-rg350-0439e0fe5873f746e6dd7f942d9a6be1a209db30.tar.gz scummvm-rg350-0439e0fe5873f746e6dd7f942d9a6be1a209db30.tar.bz2 scummvm-rg350-0439e0fe5873f746e6dd7f942d9a6be1a209db30.zip |
fixed nasty deadlock I recently introduced
svn-id: r7867
-rw-r--r-- | sound/mixer.cpp | 21 |
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); } |