Skip to content

Commit

Permalink
Change IApplicableToTrack to receive adjustable component instead
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed May 10, 2022
1 parent bbbecbb commit 4f50017
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions osu.Game/Rulesets/Mods/IApplicableToTrack.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// 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 osu.Framework.Audio.Track;
using osu.Framework.Audio;

namespace osu.Game.Rulesets.Mods
{
Expand All @@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
public interface IApplicableToTrack : IApplicableMod
{
void ApplyToTrack(ITrack track);
void ApplyToTrack(IAdjustableAudioComponent track);
}
}
6 changes: 2 additions & 4 deletions osu.Game/Rulesets/Mods/ModAdaptiveSpeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Audio;
using osu.Framework.Utils;
Expand Down Expand Up @@ -79,7 +78,7 @@ public class ModAdaptiveSpeed : Mod, IApplicableToRate, IApplicableToDrawableHit
// Apply a fixed rate change when missing, allowing the player to catch up when the rate is too fast.
private const double rate_change_on_miss = 0.95d;

private ITrack track;
private IAdjustableAudioComponent track;
private double targetRate = 1d;

/// <summary>
Expand Down Expand Up @@ -141,7 +140,7 @@ public ModAdaptiveSpeed()
AdjustPitch.BindValueChanged(adjustPitchChanged);
}

public void ApplyToTrack(ITrack track)
public void ApplyToTrack(IAdjustableAudioComponent track)
{
this.track = track;

Expand Down Expand Up @@ -210,7 +209,6 @@ public void ApplyToBeatmap(IBeatmap beatmap)
private void adjustPitchChanged(ValueChangedEvent<bool> adjustPitchSetting)
{
track?.RemoveAdjustment(adjustmentForPitchSetting(adjustPitchSetting.OldValue), SpeedChange);

track?.AddAdjustment(adjustmentForPitchSetting(adjustPitchSetting.NewValue), SpeedChange);
}

Expand Down
3 changes: 1 addition & 2 deletions osu.Game/Rulesets/Mods/ModDaycore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;

Expand All @@ -27,7 +26,7 @@ protected ModDaycore()
}, true);
}

public override void ApplyToTrack(ITrack track)
public override void ApplyToTrack(IAdjustableAudioComponent track)
{
// base.ApplyToTrack() intentionally not called (different tempo adjustment is applied)
track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust);
Expand Down
3 changes: 1 addition & 2 deletions osu.Game/Rulesets/Mods/ModMuted.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Linq;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
Expand Down Expand Up @@ -71,7 +70,7 @@ protected ModMuted()
InverseMuting.BindValueChanged(i => MuteComboCount.MinValue = i.NewValue ? 1 : 0, true);
}

public void ApplyToTrack(ITrack track)
public void ApplyToTrack(IAdjustableAudioComponent track)
{
track.AddAdjustment(AdjustableProperty.Volume, mainVolumeAdjust);
}
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Rulesets/Mods/ModNightcore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected ModNightcore()
}, true);
}

public override void ApplyToTrack(ITrack track)
public override void ApplyToTrack(IAdjustableAudioComponent track)
{
// base.ApplyToTrack() intentionally not called (different tempo adjustment is applied)
track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust);
Expand Down
3 changes: 1 addition & 2 deletions osu.Game/Rulesets/Mods/ModRateAdjust.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Audio;

Expand All @@ -15,7 +14,7 @@ public abstract class ModRateAdjust : Mod, IApplicableToRate

public abstract BindableNumber<double> SpeedChange { get; }

public virtual void ApplyToTrack(ITrack track)
public virtual void ApplyToTrack(IAdjustableAudioComponent track)
{
track.AddAdjustment(AdjustableProperty.Tempo, SpeedChange);
}
Expand Down
5 changes: 2 additions & 3 deletions osu.Game/Rulesets/Mods/ModTimeRamp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Linq;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Audio;
using osu.Game.Beatmaps;
Expand Down Expand Up @@ -46,7 +45,7 @@ public abstract class ModTimeRamp : Mod, IUpdatableByPlayfield, IApplicableToBea
Precision = 0.01,
};

private ITrack track;
private IAdjustableAudioComponent track;

protected ModTimeRamp()
{
Expand All @@ -55,7 +54,7 @@ protected ModTimeRamp()
AdjustPitch.BindValueChanged(applyPitchAdjustment);
}

public void ApplyToTrack(ITrack track)
public void ApplyToTrack(IAdjustableAudioComponent track)
{
this.track = track;

Expand Down

0 comments on commit 4f50017

Please sign in to comment.