Skip to content

Commit 6ecda9d

Browse files
authored
Merge pull request #33971 from peppy/song-select-v2-fix-ducking-overlays
Change audio ducking at song select v2 to be temporary to avoid conflict with overlays
2 parents 68ab89a + 142984c commit 6ecda9d

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

osu.Game/Screens/SelectV2/SongSelect.cs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -402,22 +402,6 @@ private void endLooping()
402402
private void ensureTrackLooping(IWorkingBeatmap beatmap, TrackChangeDirection changeDirection)
403403
=> beatmap.PrepareTrackForPreview(true);
404404

405-
private IDisposable? trackDuck;
406-
407-
private void attachTrackDuckingIfShould()
408-
{
409-
bool shouldDuck = noResultsPlaceholder.State.Value == Visibility.Visible;
410-
411-
if (shouldDuck && trackDuck == null)
412-
trackDuck = music.Duck(new DuckParameters { DuckVolumeTo = 1, DuckCutoffTo = 500 });
413-
}
414-
415-
private void detachTrackDucking()
416-
{
417-
trackDuck?.Dispose();
418-
trackDuck = null;
419-
}
420-
421405
#endregion
422406

423407
#region Selection handling
@@ -604,7 +588,6 @@ private void onArrivingAtScreen()
604588
updateWedgeVisibility();
605589

606590
beginLooping();
607-
attachTrackDuckingIfShould();
608591

609592
ensureGlobalBeatmapValid();
610593

@@ -622,7 +605,6 @@ private void onLeavingScreen()
622605
updateWedgeVisibility();
623606

624607
endLooping();
625-
detachTrackDucking();
626608
}
627609

628610
protected override void LogoArriving(OsuLogo logo, bool resuming)
@@ -748,17 +730,30 @@ private void updateNoResultsPlaceholder()
748730

749731
if (count == 0)
750732
{
733+
if (noResultsPlaceholder.State.Value == Visibility.Hidden)
734+
{
735+
// Duck audio temporarily when the no results placeholder becomes visible.
736+
//
737+
// Temporary ducking makes it easier to avoid scenarios where the ducking interacts badly
738+
// with other global UI components (like overlays).
739+
music.DuckMomentarily(400, new DuckParameters
740+
{
741+
DuckVolumeTo = 1,
742+
DuckCutoffTo = 500,
743+
DuckDuration = 250,
744+
RestoreDuration = 2000,
745+
});
746+
}
747+
751748
noResultsPlaceholder.Show();
752749
noResultsPlaceholder.Filter = carousel.Criteria!;
753750

754-
attachTrackDuckingIfShould();
755751
rightGradientBackground.ResizeWidthTo(3, 1000, Easing.OutPow10);
756752
}
757753
else
758754
{
759755
noResultsPlaceholder.Hide();
760756

761-
detachTrackDucking();
762757
rightGradientBackground.ResizeWidthTo(1, 400, Easing.OutPow10);
763758
}
764759
}

0 commit comments

Comments
 (0)