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

Remove generics from IApplicableToTrack

This commit is contained in:
smoogipoo 2020-08-06 18:25:34 +09:00
parent c8ebbc8594
commit 7c3ae4ed42
5 changed files with 11 additions and 13 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Audio;
using osu.Framework.Audio.Track; using osu.Framework.Audio.Track;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
@ -11,6 +10,6 @@ namespace osu.Game.Rulesets.Mods
/// </summary> /// </summary>
public interface IApplicableToTrack : IApplicableMod public interface IApplicableToTrack : IApplicableMod
{ {
void ApplyToTrack<T>(T track) where T : class, ITrack, IAdjustableAudioComponent; void ApplyToTrack(ITrack track);
} }
} }

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
@ -26,11 +27,11 @@ namespace osu.Game.Rulesets.Mods
}, true); }, true);
} }
public override void ApplyToTrack<T>(T track) public override void ApplyToTrack(ITrack track)
{ {
// base.ApplyToTrack() intentionally not called (different tempo adjustment is applied) // base.ApplyToTrack() intentionally not called (different tempo adjustment is applied)
track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust); (track as IAdjustableAudioComponent)?.AddAdjustment(AdjustableProperty.Frequency, freqAdjust);
track.AddAdjustment(AdjustableProperty.Tempo, tempoAdjust); (track as IAdjustableAudioComponent)?.AddAdjustment(AdjustableProperty.Tempo, tempoAdjust);
} }
} }
} }

View File

@ -38,11 +38,11 @@ namespace osu.Game.Rulesets.Mods
}, true); }, true);
} }
public override void ApplyToTrack<T>(T track) public override void ApplyToTrack(ITrack track)
{ {
// base.ApplyToTrack() intentionally not called (different tempo adjustment is applied) // base.ApplyToTrack() intentionally not called (different tempo adjustment is applied)
track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust); (track as IAdjustableAudioComponent)?.AddAdjustment(AdjustableProperty.Frequency, freqAdjust);
track.AddAdjustment(AdjustableProperty.Tempo, tempoAdjust); (track as IAdjustableAudioComponent)?.AddAdjustment(AdjustableProperty.Tempo, tempoAdjust);
} }
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset) public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)

View File

@ -12,10 +12,9 @@ namespace osu.Game.Rulesets.Mods
{ {
public abstract BindableNumber<double> SpeedChange { get; } public abstract BindableNumber<double> SpeedChange { get; }
public virtual void ApplyToTrack<T>(T track) public virtual void ApplyToTrack(ITrack track)
where T : class, ITrack, IAdjustableAudioComponent
{ {
track.AddAdjustment(AdjustableProperty.Tempo, SpeedChange); (track as IAdjustableAudioComponent)?.AddAdjustment(AdjustableProperty.Tempo, SpeedChange);
} }
public virtual void ApplyToSample(SampleChannel sample) public virtual void ApplyToSample(SampleChannel sample)

View File

@ -51,8 +51,7 @@ namespace osu.Game.Rulesets.Mods
AdjustPitch.BindValueChanged(applyPitchAdjustment); AdjustPitch.BindValueChanged(applyPitchAdjustment);
} }
public void ApplyToTrack<T>(T track) public void ApplyToTrack(ITrack track)
where T : class, ITrack, IAdjustableAudioComponent
{ {
this.track = track; this.track = track;