1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:03:11 +08:00

Add initial rate setting

This commit is contained in:
Henry Lin 2022-03-01 21:50:17 +08:00
parent c9b205afeb
commit 783f43ccfb

View File

@ -38,6 +38,16 @@ namespace osu.Game.Rulesets.Mods
public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModTimeRamp) };
[SettingSource("Initial rate", "The starting speed of the track")]
public BindableNumber<double> InitialRate { get; } = new BindableDouble
{
MinValue = 0.5,
MaxValue = 2,
Default = 1,
Value = 1,
Precision = 0.01,
};
[SettingSource("Adjust pitch", "Should pitch be adjusted with speed")]
public BindableBool AdjustPitch { get; } = new BindableBool
{
@ -54,7 +64,7 @@ namespace osu.Game.Rulesets.Mods
private ITrack track;
private readonly List<double> recentRates = Enumerable.Range(0, average_count).Select(x => 1d).ToList();
private readonly List<double> recentRates = Enumerable.Range(0, average_count).Select(_ => 1d).ToList();
// rates are calculated using the end time of the previous hit object
// caching them here for easy access
@ -62,6 +72,7 @@ namespace osu.Game.Rulesets.Mods
public ModAdaptiveSpeed()
{
InitialRate.BindValueChanged(val => SpeedChange.Value = val.NewValue);
AdjustPitch.BindValueChanged(applyPitchAdjustment);
}
@ -69,7 +80,10 @@ namespace osu.Game.Rulesets.Mods
{
this.track = track;
InitialRate.TriggerChange();
AdjustPitch.TriggerChange();
recentRates.Clear();
recentRates.AddRange(Enumerable.Range(0, average_count).Select(_ => InitialRate.Value));
}
public void ApplyToSample(DrawableSample sample)