diff options
author | Torbjörn Andersson | 2004-02-12 17:16:38 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2004-02-12 17:16:38 +0000 |
commit | 447e8d93869a614dd521644a2df62bf96859007e (patch) | |
tree | 21fdd92c9004d23610eb6616bf97b229982405b0 /sword1/animation.cpp | |
parent | 5447cd09b589990d7ffaf4df23725614420e48d4 (diff) | |
download | scummvm-rg350-447e8d93869a614dd521644a2df62bf96859007e.tar.gz scummvm-rg350-447e8d93869a614dd521644a2df62bf96859007e.tar.bz2 scummvm-rg350-447e8d93869a614dd521644a2df62bf96859007e.zip |
Updated the cutscene playback code to use the new "elapsed time" mixer
function.
svn-id: r12831
Diffstat (limited to 'sword1/animation.cpp')
-rw-r--r-- | sword1/animation.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/sword1/animation.cpp b/sword1/animation.cpp index 7a132e7703..0a07acd627 100644 --- a/sword1/animation.cpp +++ b/sword1/animation.cpp @@ -59,7 +59,7 @@ bool AnimationState::init(const char *basename) { #ifdef BACKEND_8BIT - int i, p; + uint i, p; // Load lookup palettes // TODO: Binary format so we can use File class @@ -301,29 +301,18 @@ bool AnimationState::decodeFrame() { case STATE_END: if (info->display_fbuf) { /* simple audio video sync code: - * we calculate the actual frame by taking the delivered audio samples - * we add 2 frames as the number of samples delivered is higher than the - * number actually played due to buffering - * - * we then try to stay inside +- 1 frame of this calculated frame number by - * dropping frames if we run behind and delaying if we are too fast - */ - - /* FIXME: We shouldn't use delay_msecs() here. - * We should use something like the delay() - * function in SwordEngine, so that events are - * handled properly. For now, at least call the - * backend's event handler so that redraw - * events are processed. + * we calculate the actual frame by taking the elapsed audio time and try + * to stay inside +- 1 frame of this calculated frame number by dropping + * frames if we run behind and delaying if we are too fast */ #ifdef BACKEND_8BIT if (checkPaletteSwitch() || (bgSoundStream == NULL) || - (bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){ + ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) { _scr->plotYUV(lut, sequence_i->width, sequence_i->height, info->display_fbuf->buf); if (bgSoundStream) { - while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1) + while ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum) _sys->delay_msecs(10); } else { ticks += 83; @@ -338,11 +327,11 @@ bool AnimationState::decodeFrame() { #else - if ((bgSoundStream == NULL) || (bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < (framenum+3)){ + if ((bgSoundStream == NULL) || ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum + 1)) { plotYUV(lookup, sequence_i->width, sequence_i->height, info->display_fbuf->buf); if (bgSoundStream) { - while ((bgSoundStream->getSamplesPlayed()*12/bgSoundStream->getRate()) < framenum+1) + while ((_snd->getChannelElapsedTime(bgSound) * 12) / 1000 < framenum) _sys->delay_msecs(10); } else { ticks += 83; |