Fix metronome speed not adjusted on different playback rates

This commit is contained in:
Salman Ahmed 2022-05-28 04:05:24 +03:00
parent 5eb16ff46c
commit e12d188dad
1 changed files with 7 additions and 0 deletions

View File

@ -10,6 +10,7 @@
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Timing;
using osu.Framework.Utils;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
@ -28,6 +29,8 @@ public class MetronomeDisplay : BeatSyncedContainer
private Drawable weight;
private Drawable stick;
private IAdjustableClock metronomeClock;
[Resolved]
private OverlayColourProvider overlayColourProvider { get; set; }
@ -192,6 +195,8 @@ private void load()
Y = -3,
},
};
Clock = new FramedClock(metronomeClock = new StopwatchClock(true));
}
private double beatLength;
@ -216,6 +221,8 @@ protected override void Update()
if (BeatSyncSource.ControlPoints == null || BeatSyncSource.Clock == null)
return;
metronomeClock.Rate = IsBeatSyncedWithTrack ? BeatSyncSource.Clock.Rate : 1;
timingPoint = BeatSyncSource.ControlPoints.TimingPointAt(BeatSyncSource.Clock.CurrentTime);
if (beatLength != timingPoint.BeatLength)