From d99d37c0a60c6eb95d43e920331210d4af315d6f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Jun 2022 13:06:18 +0900 Subject: [PATCH] Apply current track rate to calculated BPM --- osu.Game/Screens/Edit/Timing/TapButton.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs index 7f913e386e..6b9ac7be5c 100644 --- a/osu.Game/Screens/Edit/Timing/TapButton.cs +++ b/osu.Game/Screens/Edit/Timing/TapButton.cs @@ -18,6 +18,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Threading; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -41,6 +42,9 @@ namespace osu.Game.Screens.Edit.Timing [Resolved(canBeNull: true)] private Bindable? selectedGroup { get; set; } + [Resolved(canBeNull: true)] + private IBeatSyncProvider? beatSyncSource { get; set; } + private Circle hoverLayer = null!; private CircularContainer innerCircle = null!; @@ -299,7 +303,10 @@ namespace osu.Game.Screens.Edit.Timing return; } - double bpm = Math.Round(60000 / ((tapTimings.Last() - tapTimings.Skip(initial_taps_to_ignore).First()) / (tapTimings.Count - initial_taps_to_ignore - 1))); + double averageBeatLength = (tapTimings.Last() - tapTimings.Skip(initial_taps_to_ignore).First()) / (tapTimings.Count - initial_taps_to_ignore - 1); + double clockRate = beatSyncSource?.Clock?.Rate ?? 1; + + double bpm = Math.Round(60000 / averageBeatLength / clockRate); bpmText.Text = $"{bpm} BPM";