/// <summary> /// Makes an array of NoteRepresentations to form a triad. /// </summary> private NoteRepresentation[] MakeTriad(NoteRepresentation rep, TriadType type, TriadInversion inv = TriadInversion.Root) { switch (type) { case TriadType.Major: switch (inv) { case TriadInversion.Root: return rep.MakeGroup(Interval.MajorThird, Interval.PerfectFifth); case TriadInversion.First: return rep.MakeGroup(Interval.MinorThird, Interval.MinorSixth); case TriadInversion.Second: return rep.MakeGroup(Interval.PerfectFourth, Interval.MajorSixth); } break; case TriadType.Minor: switch (inv) { case TriadInversion.Root: return rep.MakeGroup(Interval.MinorThird, Interval.PerfectFifth); case TriadInversion.First: return rep.MakeGroup(Interval.MajorThird, Interval.MajorSixth); case TriadInversion.Second: return rep.MakeGroup(Interval.PerfectFourth, Interval.MinorSixth); } break; case TriadType.Diminished: // since diminished and augmented triads are symmetrical, they don't invert. return rep.MakeGroup(Interval.MinorThird, Interval.DiminishedFifth); case TriadType.Augmented: return rep.MakeGroup(Interval.MajorThird, Interval.AugmentedFifth); } return null; }
/// <summary> /// Make a group of note representations using this one as the bottom and applying /// a list of intervals. For example, passing in a major third and a perfect fifth /// will return the representations for a major chord. /// </summary> /// <returns>The requested representations, or Null, if the requested intervals point to notes that can't be represented /// using supported enharmonic representations (for example, an A# major chord /// would return null, since the system doesn't support C## for the third.)</returns> public NoteRepresentation[] MakeGroup(params Interval[] intervals) { var result = new NoteRepresentation[intervals.Length + 1]; result[0] = this; for (int i = 0; i < intervals.Length; i++) { var rep = this.AddInterval(intervals[i]); if (rep == null) return null; // there's at least one non-representable note in this group, so don't do it. result[i + 1] = rep; } return result; }
/// <summary> /// Creates a new StaffNote. /// </summary> public StaffNote(NoteRepresentation noteRepresentation, Staff staff) { Staff = staff; NoteRepresentation = noteRepresentation; }