diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cryo/bugs.txt | 1 | ||||
-rw-r--r-- | engines/cryo/sound.cpp | 14 | ||||
-rw-r--r-- | engines/cryo/sound.h | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/engines/cryo/bugs.txt b/engines/cryo/bugs.txt index 12d0951737..5f3c47e0e4 100644 --- a/engines/cryo/bugs.txt +++ b/engines/cryo/bugs.txt @@ -16,5 +16,4 @@ E. Bogus hitbox in upper right corner of mirror screen (under mini-map) F. Wrong frescoes cursor on PC G. Junk on a valley entrance screen on PC H. On PC, no sound during first Mungo's dialogue, memory corruption after that -I. Crackling sound in HNM videos (ex. Mac intro video) J. PC intro video is out of sync with background voice, crashes later diff --git a/engines/cryo/sound.cpp b/engines/cryo/sound.cpp index b653e60ec2..1176ccec90 100644 --- a/engines/cryo/sound.cpp +++ b/engines/cryo/sound.cpp @@ -41,12 +41,22 @@ CSoundChannel::~CSoundChannel() { delete _audioStream;
}
-void CSoundChannel::queueBuffer(byte *buffer, unsigned int size, bool playNow, bool playQueue) {
+void CSoundChannel::queueBuffer(byte *buffer, unsigned int size, bool playNow, bool playQueue, bool buffering = true) {
if (playNow)
stop();
+
+ if (!buffer || !size)
+ return;
+
if (!_audioStream)
_audioStream = Audio::makeQueuingAudioStream(_sampleRate, _stereo);
- _audioStream->queueBuffer(buffer, size, DisposeAfterUse::NO, _bufferFlags);
+
+ if (buffering) {
+ byte *localBuffer = (byte*)malloc(size);
+ memcpy(localBuffer, buffer, size);
+ _audioStream->queueBuffer(localBuffer, size, DisposeAfterUse::YES, _bufferFlags);
+ } else
+ _audioStream->queueBuffer(buffer, size, DisposeAfterUse::NO, _bufferFlags);
if (playNow || playQueue)
play();
}
diff --git a/engines/cryo/sound.h b/engines/cryo/sound.h index 2136c658a4..b05c08ea71 100644 --- a/engines/cryo/sound.h +++ b/engines/cryo/sound.h @@ -48,7 +48,7 @@ public: ~CSoundChannel();
// Queue a new buffer, cancel any previously queued buffers if playNow is set
- void queueBuffer(byte *buffer, unsigned int size, bool playNow = false, bool playQueue = true);
+ void queueBuffer(byte *buffer, unsigned int size, bool playNow = false, bool playQueue = true, bool buffering = true);
// Play any queued buffers
void play();
|