[Scummvm-git-logs] scummvm master -> a2b1164fe9ac2b77e71902493cdc699b91ebd5f2
sev-
sev at scummvm.org
Mon May 10 14:02:30 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a2b1164fe9 PINK: Preload sounds to avoid race condition.
Commit: a2b1164fe9ac2b77e71902493cdc699b91ebd5f2
https://github.com/scummvm/scummvm/commit/a2b1164fe9ac2b77e71902493cdc699b91ebd5f2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-10T16:01:23+02:00
Commit Message:
PINK: Preload sounds to avoid race condition.
Since we were reading directly from the ORB file, during video playback
we were reading both sound and video which often was leading to
the incorrect reads
Changed paths:
engines/pink/objects/actions/action_sound.cpp
diff --git a/engines/pink/objects/actions/action_sound.cpp b/engines/pink/objects/actions/action_sound.cpp
index 9be81b58fc..5ca720e1dc 100644
--- a/engines/pink/objects/actions/action_sound.cpp
+++ b/engines/pink/objects/actions/action_sound.cpp
@@ -21,6 +21,8 @@
*/
#include "common/debug.h"
+#include "common/memstream.h"
+#include "common/substream.h"
#include "pink/archive.h"
#include "pink/pink.h"
@@ -60,7 +62,16 @@ void ActionSound::start() {
} else
_actor->endAction();
- _sound.play(page->getResourceStream(_fileName), soundType, _volume, 0, _isLoop);
+ Common::SafeSeekableSubReadStream *stream = page->getResourceStream(_fileName);
+ byte *data = (byte *)malloc(stream->size());
+ stream->read(data, stream->size());
+
+ Common::MemoryReadStream *memstream = new Common::MemoryReadStream(data, stream->size(), DisposeAfterUse::YES);
+ delete stream;
+
+ Common::SafeSeekableSubReadStream *stream2 = new Common::SafeSeekableSubReadStream(memstream, 0, memstream->size(), DisposeAfterUse::YES);
+
+ _sound.play(stream2, soundType, _volume, 0, _isLoop);
debugC(6, kPinkDebugActions, "Actor %s has now ActionSound %s", _actor->getName().c_str(), _name.c_str());
}
More information about the Scummvm-git-logs
mailing list