@@ -401,7 +401,7 @@ class FreeplayState extends MusicBeatSubState
401401 // Set rememberedSongId to last played song if accessed from the RANDOM option
402402 rememberedSongId = fromResultsParams .songId ;
403403 }
404-
404+
405405 @:privateAccess
406406 this ._parentState ._constructor = () ->
407407 {
@@ -1397,7 +1397,7 @@ class FreeplayState extends MusicBeatSubState
13971397 new FlxTimer ().start (0.5 , _ ->
13981398 {
13991399 dispatchEvent (new CapsuleScriptEvent (FREEPLAY_CAPSULE_SLAM , currentCapsule , currentDifficulty , currentVariation , fromResultsParams ?. newRank ));
1400-
1400+
14011401 // Capsule slam vibration.
14021402 HapticUtil .vibrate (Constants .DEFAULT_VIBRATION_PERIOD , Constants .DEFAULT_VIBRATION_DURATION , Constants .MAX_VIBRATION_AMPLITUDE );
14031403
@@ -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 ();
3261+
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+ });
32633268
3264- // switchBackingImage(currentCapsule.freeplayData );
3269+ previewTimers . push ( previewTransition );
32653270 }
32663271
32673272 // Small vibrations every selection change.
0 commit comments