Example #1
0
 public BeatArranger(BaseNoteValue beamNoteValue, Voice ownerVoice)
 {
     _beamNoteValue   = beamNoteValue;
     _ownerVoice      = ownerVoice;
     _beamStack       = new Stack <Beam>();
     _rootBeats       = new List <IBeatElement>();
     _currentCapacity = PreciseDuration.Zero;
     _duration        = PreciseDuration.Zero;
 }
Example #2
0
        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();
            }
        }
Example #3
0
        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));
        }
Example #4
0
 private void AddToCurrentBeam(Beat beat)
 {
     _currentBeam.Elements.Add(beat);
     ((IInternalBeatElement)beat).SetOwner(_currentBeam);
     _duration += beat.GetDuration();
 }
Example #5
0
 private void InsertUnbeamedBeat(Beat beat)
 {
     this.FinishBeamStack();
     _rootBeats.Add(beat);
     _duration += beat.GetDuration();
 }