diff options
author | Max Horn | 2003-07-06 15:57:33 +0000 |
---|---|---|
committer | Max Horn | 2003-07-06 15:57:33 +0000 |
commit | 77b9a4f61e523ce741614fdb102e4cc1dd026b28 (patch) | |
tree | 5bf92d9f4267ce3a1d5b8a4f75ff88706faeb4d5 /sound | |
parent | 7de3870c130616c98526a8ee864d61a189fa7169 (diff) | |
download | scummvm-rg350-77b9a4f61e523ce741614fdb102e4cc1dd026b28.tar.gz scummvm-rg350-77b9a4f61e523ce741614fdb102e4cc1dd026b28.tar.bz2 scummvm-rg350-77b9a4f61e523ce741614fdb102e4cc1dd026b28.zip |
the mutex must be locked by everything which might access _channels while the mixer thread is running, because the mixer thread may modify _channels
svn-id: r8805
Diffstat (limited to 'sound')
-rw-r--r-- | sound/mixer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 0a51d6dad2..f5e7d4d850 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -309,6 +309,7 @@ bool SoundMixer::bindToSystem(OSystem *syst) { } void SoundMixer::stopAll() { + StackLock lock(_mutex); for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i]) _channels[i]->destroy(); @@ -320,12 +321,13 @@ void SoundMixer::stop(int index) { return; } + StackLock lock(_mutex); if (_channels[index]) _channels[index]->destroy(); } void SoundMixer::stopID(int id) { - + StackLock lock(_mutex); for (int i = 0; i != NUM_CHANNELS; i++) { if (_channels[i] != NULL && _channels[i]->_id == id) { _channels[i]->destroy(); @@ -343,6 +345,7 @@ bool SoundMixer::hasActiveSFXChannel() { // (and maybe also voice) here to work properly in iMuseDigital // games. In the past that was achieve using the _beginSlots hack. // Since we don't have that anymore, it's not that simple anymore. + StackLock lock(_mutex); for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] && !_channels[i]->isMusicChannel()) return true; @@ -350,6 +353,7 @@ bool SoundMixer::hasActiveSFXChannel() { } bool SoundMixer::isActiveChannel(int index) { + StackLock lock(_mutex); if (_channels[index]) return _channels[index]->isActive(); return false; |