Closed dtinth closed 12 years ago
Keyboard latency and audio-video sync both need different calibrations. To calibrate for keyboard latency you need to test the keyboard input relative to system time, i.e. measure the audio sampling offset between the hit keysound and the BGM with the monitor off, and then do something with that offset(skip those samples?). Audio-video sync on the other hand can be calibrated using StepMania's method.
There is no calibration for keyboard latency. The input latency is already included in Display Lag and Audio Latency value. They are both done using StepMania's method.
In display lag, the player try to play without hearing the music, and in audio latency, the player try to play by concentrating on the music.
Note that there are different values configurable, one for display lag and another for audio latency. The code is now in master, which you can try running it by downloading the code and running it in NetBeans.
Now, since we cannot determine in advance when the player will press the key, when the game has audio latency correction enabled, the game will emit the keysound for the player automatically, so the player hears it when the user has to press the button (except in the case that the player presses the key before the time that the game will trigger the keysound). That means the player will notice that the sounds are more on beat and hears less gap between keysounds.
The auto playing of keysounds will be disabled when the player misses a note, and re-enabled when the player pressed a note again. This means that the keysound of the note that the player missed will still be played, but I think that it's better than having the audio latency in every note.
To show that the method works, suppose that:
and also:
Let _t_ be the time that the game expects the input from the player,
This commits in audio latency branch tries to fix Issue #8.
Latency Class
The autosyncing code in the Render class has been factored out into the Latency class.
This class can automatically adjust its latency based on the accuracy of note hits, so we can have one syncing code for both display lag and audio latency.
Changes to Autosound
In the old version, the "Autosound" option makes a keysounded music behave like a non-keysounded music.
In this branch its behavior is changed:
Audio Latency
Audio latency works by adjusting the display and judgment timing behind the audio time (which has latency).
How to use Autosync