diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
index 5d97714ab5..c723610614 100644
--- a/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
+++ b/osu.Game.Tests/Visual/UserInterface/TestSceneBeatSyncedContainer.cs
@@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Audio.Track;
@@ -283,8 +282,6 @@ namespace osu.Game.Tests.Visual.UserInterface
if (ReferenceEquals(timingPoints[^1], current))
{
- Debug.Assert(BeatSyncSource.Clock != null);
-
return (int)Math.Ceiling((BeatSyncSource.Clock.CurrentTime - current.Time) / current.BeatLength);
}
@@ -295,8 +292,6 @@ namespace osu.Game.Tests.Visual.UserInterface
{
base.Update();
- Debug.Assert(BeatSyncSource.Clock != null);
-
timeUntilNextBeat.Value = TimeUntilNextBeat;
timeSinceLastBeat.Value = TimeSinceLastBeat;
currentTime.Value = BeatSyncSource.Clock.CurrentTime;
diff --git a/osu.Game/Beatmaps/BeatSyncProviderExtensions.cs b/osu.Game/Beatmaps/BeatSyncProviderExtensions.cs
index 767aa5df73..e2b805bf0d 100644
--- a/osu.Game/Beatmaps/BeatSyncProviderExtensions.cs
+++ b/osu.Game/Beatmaps/BeatSyncProviderExtensions.cs
@@ -5,14 +5,9 @@ namespace osu.Game.Beatmaps
{
public static class BeatSyncProviderExtensions
{
- ///
- /// Check whether beat sync is currently available.
- ///
- public static bool CheckBeatSyncAvailable(this IBeatSyncProvider provider) => provider.Clock != null;
-
///
/// Whether the beat sync provider is currently in a kiai section. Should make everything more epic.
///
- public static bool CheckIsKiaiTime(this IBeatSyncProvider provider) => provider.Clock != null && provider.ControlPoints?.EffectPointAt(provider.Clock.CurrentTime).KiaiMode == true;
+ public static bool CheckIsKiaiTime(this IBeatSyncProvider provider) => provider.ControlPoints?.EffectPointAt(provider.Clock.CurrentTime).KiaiMode == true;
}
}
diff --git a/osu.Game/Beatmaps/IBeatSyncProvider.cs b/osu.Game/Beatmaps/IBeatSyncProvider.cs
index 9ee19e720d..776552cfa5 100644
--- a/osu.Game/Beatmaps/IBeatSyncProvider.cs
+++ b/osu.Game/Beatmaps/IBeatSyncProvider.cs
@@ -24,6 +24,6 @@ namespace osu.Game.Beatmaps
///
/// Access a clock currently responsible for providing beat sync. If null, no current provider is available.
///
- IClock? Clock { get; }
+ IClock Clock { get; }
}
}
diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs
index 42b30f9d18..f911311a09 100644
--- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs
+++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs
@@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
-using System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Containers;
@@ -86,14 +85,12 @@ namespace osu.Game.Graphics.Containers
TimingControlPoint timingPoint;
EffectControlPoint effectPoint;
- IsBeatSyncedWithTrack = BeatSyncSource.CheckBeatSyncAvailable() && BeatSyncSource.Clock?.IsRunning == true;
+ IsBeatSyncedWithTrack = BeatSyncSource.Clock.IsRunning;
double currentTrackTime;
if (IsBeatSyncedWithTrack)
{
- Debug.Assert(BeatSyncSource.Clock != null);
-
currentTrackTime = BeatSyncSource.Clock.CurrentTime + EarlyActivationMilliseconds;
timingPoint = BeatSyncSource.ControlPoints?.TimingPointAt(currentTrackTime) ?? TimingControlPoint.DEFAULT;
diff --git a/osu.Game/Rulesets/Mods/MetronomeBeat.cs b/osu.Game/Rulesets/Mods/MetronomeBeat.cs
index 265970ea46..5615362d1a 100644
--- a/osu.Game/Rulesets/Mods/MetronomeBeat.cs
+++ b/osu.Game/Rulesets/Mods/MetronomeBeat.cs
@@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Mods
int timeSignature = timingPoint.TimeSignature.Numerator;
// play metronome from one measure before the first object.
- if (BeatSyncSource.Clock?.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature)
+ if (BeatSyncSource.Clock.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature)
return;
sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs
index f4a39405a1..9f03281d0c 100644
--- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs
+++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs
@@ -240,7 +240,7 @@ namespace osu.Game.Screens.Edit.Timing
{
base.Update();
- if (BeatSyncSource.ControlPoints == null || BeatSyncSource.Clock == null)
+ if (BeatSyncSource.ControlPoints == null)
return;
metronomeClock.Rate = IsBeatSyncedWithTrack ? BeatSyncSource.Clock.Rate : 1;
@@ -259,7 +259,7 @@ namespace osu.Game.Screens.Edit.Timing
this.TransformBindableTo(interpolatedBpm, (int)Math.Round(timingPoint.BPM), 600, Easing.OutQuint);
}
- if (BeatSyncSource.Clock?.IsRunning != true && isSwinging)
+ if (!BeatSyncSource.Clock.IsRunning && isSwinging)
{
swing.ClearTransforms(true);
diff --git a/osu.Game/Screens/Edit/Timing/TapButton.cs b/osu.Game/Screens/Edit/Timing/TapButton.cs
index f28c6ccf0a..fd60fb1b5b 100644
--- a/osu.Game/Screens/Edit/Timing/TapButton.cs
+++ b/osu.Game/Screens/Edit/Timing/TapButton.cs
@@ -310,7 +310,7 @@ namespace osu.Game.Screens.Edit.Timing
}
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 clockRate = beatSyncSource?.Clock.Rate ?? 1;
double bpm = Math.Round(60000 / averageBeatLength / clockRate);
diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs
index 5000a97b3d..fa26cfab46 100644
--- a/osu.Game/Screens/Menu/LogoVisualisation.cs
+++ b/osu.Game/Screens/Menu/LogoVisualisation.cs
@@ -102,8 +102,7 @@ namespace osu.Game.Screens.Menu
for (int i = 0; i < temporalAmplitudes.Length; i++)
temporalAmplitudes[i] = 0;
- if (beatSyncProvider.Clock != null)
- addAmplitudesFromSource(beatSyncProvider);
+ addAmplitudesFromSource(beatSyncProvider);
foreach (var source in amplitudeSources)
addAmplitudesFromSource(source);
diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs
index be77c9a98e..82c01ea6a1 100644
--- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs
+++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs
@@ -128,7 +128,7 @@ namespace osu.Game.Storyboards.Drawables
//
// In the case of storyboard animations, we want to synchronise with game time perfectly
// so let's get a correct time based on gameplay clock and earliest transform.
- PlaybackPosition = (beatSyncProvider.Clock?.CurrentTime ?? Clock.CurrentTime) - Animation.EarliestTransformTime;
+ PlaybackPosition = beatSyncProvider.Clock.CurrentTime - Animation.EarliestTransformTime;
}
private void skinSourceChanged()