1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Change IApplicableToTrack to receive adjustable component instead

This commit is contained in:
Salman Ahmed 2022-05-10 18:01:15 +03:00
parent bbbecbb6b7
commit 4f5001704e
7 changed files with 10 additions and 16 deletions

View File

@ -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
{
@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
public interface IApplicableToTrack : IApplicableMod
{
void ApplyToTrack(ITrack track);
void ApplyToTrack(IAdjustableAudioComponent track);
}
}

View File

@ -5,7 +5,6 @@ using System;
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;
@ -79,7 +78,7 @@ namespace osu.Game.Rulesets.Mods
// 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>
@ -141,7 +140,7 @@ namespace osu.Game.Rulesets.Mods
AdjustPitch.BindValueChanged(adjustPitchChanged);
}
public void ApplyToTrack(ITrack track)
public void ApplyToTrack(IAdjustableAudioComponent track)
{
this.track = track;
@ -210,7 +209,6 @@ namespace osu.Game.Rulesets.Mods
private void adjustPitchChanged(ValueChangedEvent<bool> adjustPitchSetting)
{
track?.RemoveAdjustment(adjustmentForPitchSetting(adjustPitchSetting.OldValue), SpeedChange);
track?.AddAdjustment(adjustmentForPitchSetting(adjustPitchSetting.NewValue), SpeedChange);
}

View File

@ -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;
@ -27,7 +26,7 @@ namespace osu.Game.Rulesets.Mods
}, 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);

View File

@ -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;
@ -71,7 +70,7 @@ namespace osu.Game.Rulesets.Mods
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);
}

View File

@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Mods
}, 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);

View File

@ -3,7 +3,6 @@
using System;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Audio;
@ -15,7 +14,7 @@ namespace osu.Game.Rulesets.Mods
public abstract BindableNumber<double> SpeedChange { get; }
public virtual void ApplyToTrack(ITrack track)
public virtual void ApplyToTrack(IAdjustableAudioComponent track)
{
track.AddAdjustment(AdjustableProperty.Tempo, SpeedChange);
}

View File

@ -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;
@ -46,7 +45,7 @@ namespace osu.Game.Rulesets.Mods
Precision = 0.01,
};
private ITrack track;
private IAdjustableAudioComponent track;
protected ModTimeRamp()
{
@ -55,7 +54,7 @@ namespace osu.Game.Rulesets.Mods
AdjustPitch.BindValueChanged(applyPitchAdjustment);
}
public void ApplyToTrack(ITrack track)
public void ApplyToTrack(IAdjustableAudioComponent track)
{
this.track = track;