public override void PlayNote(Note note) { var harpNote = HarpNote.From(note); if (RequiresAction(harpNote)) { harpNote = OptimizeNote(harpNote); PressNote(NoteMap[harpNote.Key]); } }
private HarpNote OptimizeNote(HarpNote note) { if (note.Equals(new HarpNote(HarpNote.Keys.Note1, HarpNote.Octaves.Middle)) && CurrentOctave == HarpNote.Octaves.Low) { note = new HarpNote(HarpNote.Keys.Note8, HarpNote.Octaves.Low); } else if (note.Equals(new HarpNote(HarpNote.Keys.Note1, HarpNote.Octaves.High)) && CurrentOctave == HarpNote.Octaves.Middle) { note = new HarpNote(HarpNote.Keys.Note8, HarpNote.Octaves.Middle); } return(note); }
public override void GoToOctave(Note note) { var harpNote = HarpNote.From(note); if (RequiresAction(harpNote)) { harpNote = OptimizeNote(harpNote); while (CurrentOctave != harpNote.Octave) { if (CurrentOctave < harpNote.Octave) { IncreaseOctave(); } else { DecreaseOctave(); } } } }
protected bool Equals(HarpNote other) { return(Key == other.Key && Octave == other.Octave); }
private static bool RequiresAction(HarpNote harpNote) { return(harpNote.Key != HarpNote.Keys.None); }