mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
Define local adjustments component for mods in MusicController
Isolates `CurrentTrack` from being directly adjusted by the mod, which could lead to issues depending on how the mod adds adjustments (i.e. `ModTimeRamp`, which adds adjustments based on changes to a setting bindable).
This commit is contained in:
parent
82b784ce5a
commit
725ff93f34
@ -377,6 +377,8 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly AudioAdjustments modTrackAdjustments = new AudioAdjustments();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets the adjustments currently applied on <see cref="CurrentTrack"/> and applies the mod adjustments if <see cref="AllowTrackAdjustments"/> is <c>true</c>.
|
/// Resets the adjustments currently applied on <see cref="CurrentTrack"/> and applies the mod adjustments if <see cref="AllowTrackAdjustments"/> is <c>true</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -385,15 +387,27 @@ namespace osu.Game.Overlays
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void ResetTrackAdjustments()
|
public void ResetTrackAdjustments()
|
||||||
{
|
{
|
||||||
|
// todo: we probably want a helper method rather than this.
|
||||||
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Balance);
|
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Balance);
|
||||||
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Frequency);
|
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Frequency);
|
||||||
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Tempo);
|
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Tempo);
|
||||||
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Volume);
|
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Volume);
|
||||||
|
|
||||||
if (allowTrackAdjustments)
|
modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Balance);
|
||||||
|
modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Frequency);
|
||||||
|
modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Tempo);
|
||||||
|
modTrackAdjustments.RemoveAllAdjustments(AdjustableProperty.Volume);
|
||||||
|
|
||||||
|
var applicableToTrack = mods.Value.OfType<IApplicableToTrack>();
|
||||||
|
|
||||||
|
if (!allowTrackAdjustments || !applicableToTrack.Any())
|
||||||
|
CurrentTrack.UnbindAdjustments(modTrackAdjustments);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
foreach (var mod in mods.Value.OfType<IApplicableToTrack>())
|
CurrentTrack.BindAdjustments(modTrackAdjustments);
|
||||||
mod.ApplyToTrack(CurrentTrack);
|
|
||||||
|
foreach (var mod in applicableToTrack)
|
||||||
|
mod.ApplyToTrack(modTrackAdjustments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user