// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Game.Audio; namespace osu.Game.Beatmaps.ControlPoints { public class SampleControlPoint : ControlPoint { public const string DEFAULT_BANK = "normal"; /// /// The default sample bank at this control point. /// public string SampleBank = DEFAULT_BANK; /// /// The default sample volume at this control point. /// public int SampleVolume = 100; /// /// Create a SampleInfo based on the sample settings in this control point. /// /// The name of the same. /// A populated . public SampleInfo GetSampleInfo(string sampleName = SampleInfo.HIT_NORMAL) => new SampleInfo { Bank = SampleBank, Name = sampleName, Volume = SampleVolume, }; /// /// Applies and to a if necessary, returning the modified . /// /// The . This will not be modified. /// The modified . This does not share a reference with . public virtual SampleInfo ApplyTo(SampleInfo sampleInfo) { 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) && other is SampleControlPoint sample && SampleBank.Equals(sample.SampleBank) && SampleVolume.Equals(sample.SampleVolume); } }