Skip to content

Commit 975d777

Browse files
fix(freeplay): fix song previews cutting out when navigating menus quickly
1 parent b2f3f88 commit 975d777

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

source/funkin/ui/freeplay/FreeplayState.hx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3257,11 +3257,16 @@ class FreeplayState extends MusicBeatSubState
32573257

32583258
if (grpCapsules.countLiving() > 0 && !prepForNewRank && uiStateMachine.canInteract())
32593259
{
3260-
FlxG.sound.music?.pause();
3261-
FlxTimer.wait(FADE_IN_DELAY, playCurSongPreview.bind(currentCapsule));
3262-
currentCapsule.selected = true;
3260+
clearPreviews();
32633261

3264-
// switchBackingImage(currentCapsule.freeplayData);
3262+
// Create a timer to delay the song preview to prevent overlapping or cutting out.
3263+
var previewTransition = new FlxTimer().start(FADE_IN_DELAY, function(_)
3264+
{
3265+
if (FlxG.sound.music != null) FlxG.sound.music.stop();
3266+
playCurSongPreview(currentCapsule);
3267+
});
3268+
3269+
previewTimers.push(previewTransition);
32653270
}
32663271

32673272
// Small vibrations every selection change.

0 commit comments

Comments
 (0)