public BeatArranger(BaseNoteValue beamNoteValue, Voice ownerVoice) { _beamNoteValue = beamNoteValue; _ownerVoice = ownerVoice; _beamStack = new Stack <Beam>(); _rootBeats = new List <IBeatElement>(); _currentCapacity = PreciseDuration.Zero; _duration = PreciseDuration.Zero; }
private void StartRootBeam(int?tuplet) { _currentBeam = new Beam(_beamNoteValue.Half(), _ownerVoice, true) { Tuplet = tuplet }; _rootBeats.Add(_currentBeam); _beamStack.Push(_currentBeam); while (_currentCapacity <= _duration) { _currentCapacity += _beamNoteValue.GetDuration(); } }
private async Task <double> GetColumnMinWidthInBar(PrimitiveRenderer primitiveRenderer, BarColumn column, PreciseDuration minDurationInBar) { var columnRegularWidth = Math.Min(this.Style.MaximumBeatSizeWithoutLyrics, this.Style.MinimumBeatSize * column.GetDuration() / minDurationInBar); double columnMinWidth; if (column.Lyrics == null) { columnMinWidth = this.Style.MinimumBeatSize; } else { var lyricsBounds = await primitiveRenderer.MeasureLyrics(column.Lyrics.Text); columnMinWidth = Math.Max(this.Style.MinimumBeatSize, lyricsBounds.Width); } return(Math.Max(columnRegularWidth, columnMinWidth)); }
private void AddToCurrentBeam(Beat beat) { _currentBeam.Elements.Add(beat); ((IInternalBeatElement)beat).SetOwner(_currentBeam); _duration += beat.GetDuration(); }
private void InsertUnbeamedBeat(Beat beat) { this.FinishBeamStack(); _rootBeats.Add(beat); _duration += beat.GetDuration(); }