mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-19 10:41:55 +00:00
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
This commit is contained in:
parent
dc94b96a95
commit
a2b1164fe9
@ -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());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user