2022-09-06 19:06:30 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
{
|
|
|
|
public static class GameplayClockExtensions
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The rate of gameplay when playback is at 100%.
|
|
|
|
/// This excludes any seeking / user adjustments.
|
|
|
|
/// </summary>
|
|
|
|
public static double GetTrueGameplayRate(this IGameplayClock clock)
|
|
|
|
{
|
2022-09-07 16:38:00 +08:00
|
|
|
// To handle rewind, we still want to maintain the same direction as the underlying clock.
|
2022-09-07 18:23:44 +08:00
|
|
|
double rate = clock.Rate == 0 ? 1 : Math.Sign(clock.Rate);
|
2022-09-07 16:38:00 +08:00
|
|
|
|
|
|
|
return rate
|
2022-09-08 16:14:06 +08:00
|
|
|
* clock.AdjustmentsFromMods.AggregateFrequency.Value
|
|
|
|
* clock.AdjustmentsFromMods.AggregateTempo.Value;
|
2022-09-06 19:06:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|