ZVISION: Fix lag at beginning of cutscenes

We have to update _curChunk when decoding audio, otherwise it will
decode the entire audio track on the first frame. For the ZGI intro
this would take 700-800 ms, and since the audio started playing
before the video it looked to me as if it had to play the first bit
faster to catch up.

Thanks to fuzzie for setting me on the right track with an off-hand
remark about the Zork AVI decoder (I was looking at the standard
AVI decoder), and for finding the cause a few seconds before I did.
This commit is contained in:
Torbjörn Andersson 2015-01-24 14:54:25 +01:00
parent bf3e2bca07
commit ca83ecd8c2

View File

@ -39,6 +39,7 @@ Video::AVIDecoder::AVIAudioTrack *ZorkAVIDecoder::createAudioTrack(Video::AVIDec
}
void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *stream) {
bool updateCurChunk = true;
if (_audStream) {
if (_wvInfo.tag == kWaveFormatZorkPCM) {
assert(_wvInfo.size == 8);
@ -54,9 +55,17 @@ void ZorkAVIDecoder::ZorkAVIAudioTrack::queueSound(Common::SeekableReadStream *s
_audStream->queueBuffer((byte *)chunk.data, chunk.size, DisposeAfterUse::YES, flags);
}
} else {
updateCurChunk = false;
AVIAudioTrack::queueSound(stream);
}
}
// The superclass always updates _curChunk, whether or not audio has
// been queued, so we should do that too. Unless the superclass already
// has done it for us.
if (updateCurChunk) {
_curChunk++;
}
}
void ZorkAVIDecoder::ZorkAVIAudioTrack::resetStream() {