private static void SetMoleOrCross(StringBuilder stringBuilder, Note n) { if (n.moleOrCross == MoleOrCross.Cross) { stringBuilder.Append("is"); } if (n.moleOrCross == MoleOrCross.Mole) { stringBuilder.Append("es"); } }
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)); } }
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("~"); } }
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); }
private static void SetDuration(StringBuilder stringBuilder, Note n) { int duration = (int)n.duration; stringBuilder.Append(duration.ToString()); }