mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Make SampleControlPoint clone the existing SampleInfo
This commit is contained in:
@ -32,5 +32,7 @@ namespace osu.Game.Audio
|
||||
/// The sample volume.
|
||||
/// </summary>
|
||||
public int Volume;
|
||||
|
||||
public SampleInfo Clone() => (SampleInfo)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
|
@ -36,12 +36,14 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// </summary>
|
||||
/// <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>
|
||||
public virtual SampleInfo ApplyTo(SampleInfo sampleInfo) => new SampleInfo
|
||||
public virtual SampleInfo ApplyTo(SampleInfo sampleInfo)
|
||||
{
|
||||
Bank = sampleInfo.Bank ?? SampleBank,
|
||||
Name = sampleInfo.Name,
|
||||
Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume
|
||||
};
|
||||
var newSampleInfo = sampleInfo.Clone();
|
||||
newSampleInfo.Bank = sampleInfo.Bank ?? SampleBank;
|
||||
newSampleInfo.Name = sampleInfo.Name;
|
||||
newSampleInfo.Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume;
|
||||
return newSampleInfo;
|
||||
}
|
||||
|
||||
public override bool ChangeEquals(ControlPoint other)
|
||||
=> base.ChangeEquals(other)
|
||||
|
Reference in New Issue
Block a user