Fix WindUp applying too much change

This commit is contained in:
Dean Herbert 2019-12-12 17:45:11 +09:00
parent 623ab1ef3b
commit af15662856
3 changed files with 8 additions and 6 deletions

View File

@ -45,6 +45,8 @@ public void ApplyToTrack(Track track)
{
this.track = track;
track.AddAdjustment(AdjustableProperty.Frequency, SpeedChange);
FinalRate.TriggerChange();
}
public virtual void ApplyToBeatmap(IBeatmap beatmap)
@ -67,6 +69,6 @@ public virtual void Update(Playfield playfield)
/// </summary>
/// <param name="amount">The amount of adjustment to apply (from 0..1).</param>
private void applyAdjustment(double amount) =>
SpeedChange.Value = 1 + (Math.Sign(FinalRate.Value) * Math.Clamp(amount, 0, 1) * Math.Abs(FinalRate.Value));
SpeedChange.Value = 1 + (FinalRate.Value - 1) * Math.Clamp(amount, 0, 1);
}
}

View File

@ -20,10 +20,10 @@ public class ModWindDown : ModTimeRamp
[SettingSource("Final rate", "The speed increase to ramp towards")]
public override BindableNumber<double> FinalRate { get; } = new BindableDouble
{
MinValue = -0.5,
MaxValue = -0.01,
Default = -0.25,
Value = -0.25,
MinValue = 0.5,
MaxValue = 0.99,
Default = 0.75,
Value = 0.75,
Precision = 0.01,
};

View File

@ -20,7 +20,7 @@ public class ModWindUp : ModTimeRamp
[SettingSource("Final rate", "The speed increase to ramp towards")]
public override BindableNumber<double> FinalRate { get; } = new BindableDouble
{
MinValue = 0.01,
MinValue = 1.01,
MaxValue = 2,
Default = 1.5,
Value = 1.5,