From 49a21736464330baf0333ff5bfec2461885edd50 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 May 2022 14:33:05 +0900 Subject: [PATCH] Avoid needlessly updating display (and add better documentation on chosen scale) --- .../Screens/Edit/Timing/WaveformComparisonDisplay.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs index ad4e1e737d..0830ba8cf4 100644 --- a/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/WaveformComparisonDisplay.cs @@ -136,14 +136,21 @@ namespace osu.Game.Screens.Edit.Timing if (!IsHovered) { - int beatOffset = (int)Math.Floor((editorClock.CurrentTimeAccurate - selectedGroupStartTime) / timingPoint.BeatLength); + int currentBeat = (int)Math.Floor((editorClock.CurrentTimeAccurate - selectedGroupStartTime) / timingPoint.BeatLength); - showFrom(beatOffset); + showFrom(currentBeat); } } private void showFrom(int beatIndex) { + if (lastDisplayedBeatIndex == beatIndex) + return; + + // Chosen as a pretty usable number across all BPMs. + // Optimally we'd want this to scale with the BPM in question, but performing + // scaling of the display is both expensive in resampling, and decreases usability + // (as it is harder to track the waveform when making realtime adjustments). const float visible_width = 300; float trackLength = (float)beatmap.Value.Track.Length;