From ae31a8fadfaf92bf477f050b3f02f5b4fc267839 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Sep 2023 16:19:53 +0900 Subject: [PATCH 1/2] Reduce delay before loading beatmap after selection change at song select This was originally set high because of performance concerns. We have since improved things quite drastically. Even with a very low debounce my song select is amazingly smooth. This is about as low as we can got unless we want chaos when key repeating left/right arrows (it's not as bad as you think, maybe worth testing during review and see if it feels more expected?). Of note, stable has key repeat disabled on left/right arrows and zero debounce. Addresses concerns in https://github.com/ppy/osu/discussions/24916. --- osu.Game/Screens/Select/SongSelect.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 34ee0ae4e8..9c2b1cfe37 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -525,7 +525,11 @@ namespace osu.Game.Screens.Select if (beatmapInfoNoDebounce == null) run(); else - selectionChangedDebounce = Scheduler.AddDelayed(run, 200); + { + // Intentionally slightly higher than repeat_tick_rate to avoid loading songs when holding left / right arrows. + // See https://github.com/ppy/osu-framework/blob/master/osu.Framework/Input/InputManager.cs#L44 + selectionChangedDebounce = Scheduler.AddDelayed(run, 80); + } if (beatmap?.Equals(beatmapInfoPrevious) != true) { From 4d5b2477dc92cf231f0221581ba16d30d29e9080 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Sep 2023 15:59:06 +0900 Subject: [PATCH 2/2] Fix failing song select tack transfer test by using a real track --- osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 43a7da0c28..6737ec9739 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -312,7 +312,9 @@ namespace osu.Game.Tests.Visual.SongSelect { createSongSelect(); - addRulesetImportStep(0); + // We need to use one real beatmap to trigger the "same-track-transfer" logic that we're looking to test here. + // See `SongSelect.ensurePlayingSelected` and `WorkingBeatmap.TryTransferTrack`. + AddStep("import test beatmap", () => manager.Import(new ImportTask(TestResources.GetTestBeatmapForImport())).WaitSafely()); addRulesetImportStep(0); checkMusicPlaying(true); @@ -321,6 +323,8 @@ namespace osu.Game.Tests.Visual.SongSelect AddStep("manual pause", () => music.TogglePause()); checkMusicPlaying(false); + + // Track should not have changed, so music should still not be playing. AddStep("select next difficulty", () => songSelect!.Carousel.SelectNext(skipDifficulties: false)); checkMusicPlaying(false);