Improve sound/music playback timing
NY00123 opened this issue · 3 comments
NY00123 commented
Right now, the title music plays slower than the original matching DOS version.
This experimental change partially resolves the differences, but there may still be precision errors (especially right after starting the program):
diff --git a/src/swsound.c b/src/swsound.c
index 1da8869..d3d68b9 100644
--- a/src/swsound.c
+++ b/src/swsound.c
@@ -607,7 +607,7 @@ void swsndupdate(void)
int thisclock = Timer_GetMS();
if (thisclock > lastclock + 1000 / 18.2) {
- lastclock = thisclock;
+ lastclock += 1000 / 18.2;
soundadj();
}
}
NY00123 commented
Reopening this, because my patch has a problem that I recall observing and is still reproduced here: A part of the track is skipped upon starting the program, but not later (after "game over").