예제 #1
0
 private static void SetMoleOrCross(StringBuilder stringBuilder, Note n)
 {
     if (n.moleOrCross == MoleOrCross.Cross)
     {
         stringBuilder.Append("is");
     }
     if (n.moleOrCross == MoleOrCross.Mole)
     {
         stringBuilder.Append("es");
     }
 }
예제 #2
0
        private static void SetOctave(StringBuilder stringBuilder, Note n)
        {
            int numberContras = (int)n.octave;

            if (numberContras > 0)
            {
                stringBuilder.Append(new string('\'', numberContras));
            }
            else
            {
                stringBuilder.Append(new string(',', numberContras * -1));
            }
        }
예제 #3
0
        private static void AddNote(StringBuilder stringBuilder, Note n)
        {
            stringBuilder.Append(n.pitch);
            SetMoleOrCross(stringBuilder, n);
            SetOctave(stringBuilder, n);
            SetDuration(stringBuilder, n);

            stringBuilder.Append(new string('.', n.points) + " ");

            if (n.hasTilde)
            {
                //crash prevention
                //stringBuilder.Append("~");
            }
        }
예제 #4
0
        private PSAMControlLibrary.Note PsamNote(Note note, ref List <MusicalSymbol> symbols)
        {
            WpfStaffComponent component = new WpfStaffComponent();

            component.AddComponent(new PitchDecorator()
            {
                Pitch = note.pitch
            });
            component.AddComponent(new NoteDurationDecorator()
            {
                Length = (int)note.duration
            });
            component.AddComponent(new AlterDecorator()
            {
                MoleOrCross = note.moleOrCross
            });
            component.AddComponent(new DotsDecorator()
            {
                Dots = note.points
            });
            component.AddComponent(new OctaveDecorator()
            {
                Octave = note.octave
            });

            if (note.hasTilde)
            {
                component.AddComponent(new TildeDecorator());
            }

            NoteValues values = component.ExecuteAll(ref symbols);

            PSAMControlLibrary.Note psamNote = new PSAMControlLibrary.Note(
                values.NoteStep,
                values.NoteAlter,
                values.Octave,
                values.Duration,
                values.StemDirection,
                values.TieType,
                values.BeamTypes
                );

            psamNote.NumberOfDots = values.NumberOfDots;
            return(psamNote);
        }
예제 #5
0
        private static void SetDuration(StringBuilder stringBuilder, Note n)
        {
            int duration = (int)n.duration;

            stringBuilder.Append(duration.ToString());
        }