aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-02-10 23:15:08 -0500
committerPaul Gilbert2017-02-10 23:15:08 -0500
commit74222486250c777624c3d510b2d57024dba569b8 (patch)
tree7cf7de58491282e30cb3df05a9b8e158889be486 /engines/titanic
parent82815658f2819f395d467cdfdd748f15ca82dbf6 (diff)
downloadscummvm-rg350-74222486250c777624c3d510b2d57024dba569b8.tar.gz
scummvm-rg350-74222486250c777624c3d510b2d57024dba569b8.tar.bz2
scummvm-rg350-74222486250c777624c3d510b2d57024dba569b8.zip
TITANIC: Use critical section methods when reading from audio buffer
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/sound/wave_file.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp
index 4a9f64b0cb..a4cd9d3e3f 100644
--- a/engines/titanic/sound/wave_file.cpp
+++ b/engines/titanic/sound/wave_file.cpp
@@ -48,12 +48,14 @@ public:
};
int AudioBufferStream::readBuffer(int16 *buffer, const int numSamples) {
+ _audioBuffer->enterCriticalSection();
int samplesToRead = MIN((const int)numSamples, (const int)(_audioBuffer->getBytesToRead() / sizeof(uint16)));
const int16 *src = _audioBuffer->getReadPtr();
Common::copy(src, src + samplesToRead, buffer);
_audioBuffer->advanceRead(samplesToRead * 2);
+ _audioBuffer->leaveCriticalSection();
return samplesToRead;
}