Skip to content

Commit

Permalink
Set playspeed after variation load
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasercar committed Feb 23, 2025
1 parent 5054c58 commit ae43086
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/funkin/ui/debug/charting/ChartEditorState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6322,6 +6322,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState

public function postLoadInstrumental():Void
{
var playbackRate = ((menubarItemPlaybackSpeed.value ?? 1.0) * 2.0) / 100.0;
playbackRate = Math.floor(playbackRate / 0.05) * 0.05; // Round to nearest 5%
playbackRate = Math.max(0.05, Math.min(2.0, playbackRate)); // Clamp to 5% to 200%
if (audioInstTrack != null)
{
// Prevent the time from skipping back to 0 when the song ends.
Expand All @@ -6331,8 +6334,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
audioInstTrack.pause();
// Keep the track at the end.
audioInstTrack.time = audioInstTrack.length;
audioInstTrack.pitch = playbackRate;
}
audioVocalTrackGroup.pause();
audioVocalTrackGroup.pitch = playbackRate;
};
}
else
Expand Down

0 comments on commit ae43086

Please sign in to comment.