#8058 closed patch
RFC: Timer-based CD audio sync
Reported by: | eriktorbjorn | Owned by: | Kirben |
---|---|---|---|
Priority: | normal | Component: | Engine: SCUMM |
Version: | Keywords: | ||
Cc: | Game: | Monkey Island 1 |
Description
This is an experimental patch that uses a real timer to update the "MI1 timer", i.e. the timer that is responsible for keeping the game in sync with CD audio.
My reasoning for this is that it's hard for scummLoop() to keep the time on its own, what with things like screen effects causing unpredictable delays while the CD track just keeps running in the background.
At first I wanted to use the current position in the CD/MP3 track, but that turned out to be tricky, and it would still need a fallback mechanism in case the sound fails to play for whatever reason.
It isn't flawless. For one thing, keeping in sync with the Loom CD isn't an exact science. Another problem is that the timer keeps running even when the game is paused, which completely screws up the sync when the game is resumed. (Hmm... it didn't occur to me until now, but could the timer handler check for that condition somehow?) Reloading a saved game in the middle of a timed sequence might be a bit off, too, but it should make a reasonably dignified recovery.
But aside from that bug, and regardless of how we implement it, I don't think we'll ever be able to get better sync than what this patch provides.
I've tested this patch with the Loom CD, and the MI1 intro, and they currently require slightly different timing, so I'd be grateful if someone could test it with whatever other games there are that use CD audio. (Zak 256?)
Ticket imported from: #611997. Ticket imported from: patches/163.
Attachments (4)
Change History (15)
by , 22 years ago
Attachment: | cd-timer.diff added |
---|
by , 22 years ago
Attachment: | cd-timer2.diff added |
---|
Updated patch against a September 20 CVS snapshot
comment:1 by , 22 years ago
I've cleaned the patch up slightly. Pausing the game seems to work properly now.
I'm still not very clear on what I can and cannot do from a timer handler. I didn't dare to manipulate _vars[] directly, but if it's ok to do that, then the code could be simplified a bit more. (If it's not, then I don't know if what I do currently is ok either, but at least it's easier to fix. :-)
comment:3 by , 22 years ago
Status: | new → closed |
---|
comment:4 by , 22 years ago
Owner: | set to |
---|
comment:5 by , 22 years ago
Status: | closed → new |
---|
comment:6 by , 22 years ago
If I understand things right, this patch may be needed for *some* versions of monkeyvga. It's completely untested. In fact, I don't even know if it compiles.
comment:7 by , 22 years ago
There was a slight typo in the previous patch, so here's a new one. Trin` has tested the patch and says it's working, so assuming this one compiles, it should be the final version.
comment:8 by , 22 years ago
Yes looks good for german MI1 VGA floppy version (using "GID_MONKEY_VGA").
comment:9 by , 22 years ago
I could have sworn I attached a patch yesterday where I had fixed the typo. Oh well, let's try it again...
comment:10 by , 22 years ago
Status: | new → closed |
---|
comment:11 by , 6 years ago
Component: | → Engine: SCUMM |
---|---|
Game: | → Monkey Island 1 |
Patch against a September 19 CVS snapshot