mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Make SampleControlPoint clone the existing SampleInfo
This commit is contained in:
@ -32,5 +32,7 @@ namespace osu.Game.Audio
|
|||||||
/// The sample volume.
|
/// The sample volume.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Volume;
|
public int Volume;
|
||||||
|
|
||||||
|
public SampleInfo Clone() => (SampleInfo)MemberwiseClone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,12 +36,14 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sampleInfo">The <see cref="SampleInfo"/>. This will not be modified.</param>
|
/// <param name="sampleInfo">The <see cref="SampleInfo"/>. This will not be modified.</param>
|
||||||
/// <returns>The modified <see cref="SampleInfo"/>. This does not share a reference with <paramref name="sampleInfo"/>.</returns>
|
/// <returns>The modified <see cref="SampleInfo"/>. This does not share a reference with <paramref name="sampleInfo"/>.</returns>
|
||||||
public virtual SampleInfo ApplyTo(SampleInfo sampleInfo) => new SampleInfo
|
public virtual SampleInfo ApplyTo(SampleInfo sampleInfo)
|
||||||
{
|
{
|
||||||
Bank = sampleInfo.Bank ?? SampleBank,
|
var newSampleInfo = sampleInfo.Clone();
|
||||||
Name = sampleInfo.Name,
|
newSampleInfo.Bank = sampleInfo.Bank ?? SampleBank;
|
||||||
Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume
|
newSampleInfo.Name = sampleInfo.Name;
|
||||||
};
|
newSampleInfo.Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume;
|
||||||
|
return newSampleInfo;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool ChangeEquals(ControlPoint other)
|
public override bool ChangeEquals(ControlPoint other)
|
||||||
=> base.ChangeEquals(other)
|
=> base.ChangeEquals(other)
|
||||||
|
Reference in New Issue
Block a user