Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve sound/music playback timing #24

Open
NY00123 opened this issue Jul 30, 2023 · 1 comment
Open

Improve sound/music playback timing #24

NY00123 opened this issue Jul 30, 2023 · 1 comment

Comments

@NY00123
Copy link
Collaborator

NY00123 commented Jul 30, 2023

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
Copy link
Collaborator Author

NY00123 commented Feb 3, 2024

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").

@NY00123 NY00123 reopened this Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant