namespace RhythmBase.Events { /// /// Represents an event to set the number of crotchets per bar. /// public class SetCrotchetsPerBar : BaseEvent, IBarBeginningEvent { /// /// Initializes a new instance of the class. /// public SetCrotchetsPerBar() { _crotchetsPerBar = 7U; Type = EventType.SetCrotchetsPerBar; Tab = Tabs.Sounds; } /// /// Gets the type of the event. /// public override EventType Type { get; } /// /// Gets the tab associated with the event. /// public override Tabs Tab { get; } /// /// Gets or sets the visual beat multiplier. /// /// Thrown when the value is less than 1. public float VisualBeatMultiplier { get; set; } = 1; /// /// Gets or sets the number of crotchets per bar. /// public uint CrotchetsPerBar { get => (uint)(_crotchetsPerBar + 1); set { _crotchetsPerBar = checked((uint)(unchecked((ulong)value) - 1UL)); if (_beat._calculator != null) { Beat += 0f; } } } /// /// Returns a string that represents the current object. /// /// A string that represents the current object. public override string ToString() => base.ToString() + $" CPB:{_crotchetsPerBar + 1}"; /// /// The number of crotchets per bar. /// protected internal uint _crotchetsPerBar; } }