BS2: Bad audio/video sync in cutscenes
|Reported by:||eriktorbjorn||Owned by:||eriktorbjorn|
|Cc:||Game:||Broken Sword 2|
For some reason, when I run BS2 on my Linux box cutscene playback is smooth and well synced. However, when I try it on a Windows box, the playback is jerky (but well synced).
The jerkiness does not come from dropped frames or anything like that. The Windows box is much faster than my Linux box anyway. Instead, it appears to be because the getSamplesPlayed() method of finding out how much of the sound has played is simply too coarse in this case.
Each time readBuffer() is called, it requests 11024 new samples, which means the returned value from getSamplesPlayed() is increased by 5512. (When I play MI1CD each call to readBuffer() requests 512 samples. I don't know why the difference is so great.)
From what I understand, this means that the approximation for number video frames to play increases in steps of three.
I can make the playback smoother by having getSamplesPlayed() return an approximation based on when readBuffer() was last called. I haven't checked how that impacts syncing - the playback code makes assumptions about the returned value being inaccurate - but that hack is probably too ugly to live anyway...
Ticket imported from: #880484. Ticket imported from: bugs/1399.