diff options
-rw-r--r-- | engines/titanic/sound/wave_file.cpp | 2 |
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; } |