예제 #1
0
        public override void PlayNote(Note note)
        {
            var harpNote = HarpNote.From(note);

            if (RequiresAction(harpNote))
            {
                harpNote = OptimizeNote(harpNote);
                PressNote(NoteMap[harpNote.Key]);
            }
        }
예제 #2
0
 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);
 }
예제 #3
0
        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();
                    }
                }
            }
        }
예제 #4
0
 protected bool Equals(HarpNote other)
 {
     return(Key == other.Key && Octave == other.Octave);
 }
예제 #5
0
 private static bool RequiresAction(HarpNote harpNote)
 {
     return(harpNote.Key != HarpNote.Keys.None);
 }