Example #1
0
 public override void Interpret(LilypondContext context)
 {
     foreach (Expression expression in ChildExpressions)
     {
         expression.Interpret(context);
     }
 }
 public override void Interpret(LilypondContext context)
 {
     context.Sequence.Symbols.Add(new Barline
     {
         RepeatType           = _repeat ? RepeatType.Backward : RepeatType.None,
         AlternateRepeatGroup = context.CurrentAlternativeGroup
     });
 }
        public override void Interpret(LilypondContext context)
        {
            context.InRepeat = true;

            context.Sequence.Symbols.Add(new Barline()
            {
                RepeatType = RepeatType.Forward
            });

            base.Interpret(context);
        }
        public override void Interpret(LilypondContext context)
        {
            context.CurrentAlternativeGroup = 1;

            base.Interpret(context);

            // Reset the alternative group count and end the last alternative group with a barline
            context.CurrentAlternativeGroup = 0;

            context.Sequence.Symbols.Add(new Barline());
        }
Example #5
0
        public override void Interpret(LilypondContext context)
        {
            // The second alternative group has a backward repeat barline
            RepeatType repeatType = context.CurrentAlternativeGroup == 2 ? RepeatType.Backward : RepeatType.None;

            context.Sequence.Symbols.Add(new Barline
            {
                AlternateRepeatGroup = context.CurrentAlternativeGroup,
                RepeatType           = repeatType
            });

            base.Interpret(context);

            context.CurrentAlternativeGroup++;
        }
Example #6
0
        public override void Interpret(LilypondContext context)
        {
            if (_noteName == 'r')
            {
                // This note is a rest
                context.Sequence.Symbols.Add(new Rest {
                    Duration = (MusicalSymbolDuration)_length
                });
                return;
            }

            // Raise or lower the current octave based on the distance between the previous/current note
            if (context.PreviousNotePitch != null)
            {
                if (context.PreviousNotePitch - _notePitch > 5)
                {
                    context.CurrentOctave++;
                }
                else if (_notePitch - context.PreviousNotePitch > 5)
                {
                    context.CurrentOctave--;
                }
            }

            context.CurrentOctave += _octaveChange;

            // Link the note and the note decorations
            NoteDecoration previousDecoration = null;

            foreach (NoteDecoration decoration in _noteProperties)
            {
                if (previousDecoration != null)
                {
                    previousDecoration.Note = decoration;
                }
                else
                {
                    previousDecoration = decoration;
                }
            }

            // Linking notes
            NoteTieType tieType = NoteTieType.None;

            if (context.LinkingNote && _linkingNote)
            {
                tieType = NoteTieType.StopAndStartAnother;
            }
            else if (context.LinkingNote)
            {
                tieType = NoteTieType.Stop;
            }
            else if (_linkingNote)
            {
                tieType = NoteTieType.Start;
            }

            context.PreviousTieType = tieType;

            INote note = new Note
            {
                NoteName    = _noteName,
                Pitch       = _notePitch + context.CurrentOctave * 12,
                Duration    = (MusicalSymbolDuration)_length,
                NoteTieType = tieType
            };

            _noteProperties.Add(note);

            if (previousDecoration != null)
            {
                previousDecoration.Note = note;
            }

            context.Sequence.Symbols.Add(_noteProperties.First());

            context.PreviousNotePitch = _notePitch;
        }
Example #7
0
 public override void Interpret(LilypondContext context)
 {
     context.Sequence.BeatsPerMinute = _bpm;
 }
Example #8
0
 public override void Interpret(LilypondContext context)
 {
     context.Sequence.Symbols.Add(new TimeSignature(_beatUnit, _beatsPerBar));
 }
 public override void Interpret(LilypondContext context)
 {
     context.Sequence.Symbols.Add(new Clef(_clefType));
     context.ClefAdded = true;
 }