Example #1
0
        /// <summary>
        /// Returns whether this note is an accidental.
        /// </summary>
        /// <param name="includeWeirdAccidentals">
        /// If true, E will be included as "Fb", F will be included as E#, etc.
        /// </param>
        public static bool IsAccidental(this NoteValues note, bool includeWeirdAccidentals)
        {
            switch (note)
            {
            case NoteValues.A:
            case NoteValues.D:
            case NoteValues.G:
                return(false);

            case NoteValues.B:
            case NoteValues.C:
            case NoteValues.E:
            case NoteValues.F:
                return(includeWeirdAccidentals);

            case NoteValues.ASharp:
            case NoteValues.CSharp:
            case NoteValues.DSharp:
            case NoteValues.FSharp:
            case NoteValues.GSharp:
                return(true);

            default: throw new NotImplementedException(note.ToString());
            }
        }
Example #2
0
        public NoteValues ExecuteAll(ref List <MusicalSymbol> symbols)
        {
            NoteValues noteValues = new NoteValues();

            foreach (var wpfComponent in _components)
            {
                wpfComponent.Execute(ref noteValues, ref symbols);
            }
            return(noteValues);
        }
        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);
        }
Example #4
0
 public Note(NoteValues value, sbyte octave = 4)
 {
     Value  = value;
     Octave = octave;
 }