Fixed the lerp speed when changing playback rate

This commit is contained in:
Karim Akra
2025-08-06 01:02:34 +08:00
committed by Hundrec
parent 3a30b681b6
commit a2f7fa9ef4
+2 -2
View File
@@ -639,7 +639,7 @@ class PlayState extends MusicBeatSubState
/**
* The ratio for easing the song positon for smoother notes scrolling.
*/
static final MUSIC_EASE_RATIO:Float = 33.5;
static final MUSIC_EASE_RATIO:Float = 40;
// TODO: Refactor or document
var generatedMusic:Bool = false;
@@ -1080,7 +1080,7 @@ class PlayState extends MusicBeatSubState
// The previous method where it "guessed" the song position based on the elapsed time had some flaws
// Somtimes the songPosition would exceed the music length causing issues in other places
// And it was frame dependant which we don't like!!
final easeRatio:Float = 1.0 - Math.exp(-MUSIC_EASE_RATIO * elapsed);
final easeRatio:Float = 1.0 - Math.exp(-(MUSIC_EASE_RATIO * playbackRate) * elapsed);
Conductor.instance.update(FlxMath.lerp(Conductor.instance.songPosition, FlxG.sound.music.time + Conductor.instance.combinedOffset, easeRatio), false);
// If, after updating the conductor, the instrumental has finished, end the song immediately.