1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 10:22:56 +08:00

Apply current track rate to calculated BPM

This commit is contained in:
Dean Herbert 2022-06-02 13:06:18 +09:00
parent 943e904c71
commit d99d37c0a6

View File

@ -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<ControlPointGroup>? 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";