using RhythmBase.Components; using RhythmBase.Extensions; namespace RhythmBase.Events { /// /// Represents the base class for events that have a beats per minute (BPM) value. /// public abstract class BaseBeatsPerMinute : BaseEvent { /// /// Initializes a new instance of the class with a default BPM of 100. /// protected BaseBeatsPerMinute() { _bpm = Utils.Utils.DefaultBPM; } /// /// Gets or sets the beat associated with this event. /// public override RDBeat Beat { get { return base.Beat; } set { base.Beat = value; ResetTimeLine(); } } /// /// Gets or sets the beats per minute (BPM) for this event. /// public virtual float BeatsPerMinute { get { return _bpm; } set { _bpm = value; ResetTimeLine(); } } /// /// Resets the timeline for all events in the same level that occur after this event. /// private void ResetTimeLine() { if (Beat.BaseLevel != null) { foreach (IBaseEvent item in from i in Beat.BaseLevel where i.Beat > Beat select i) { item.Beat.ResetBPM(); } } } private float _bpm; } }