Пример #1
0
 private bool compareTime(NoteObj n)
 {
     if (n.time._minutes == _minutes)
     {
         if (n.time._seconds == _seconds)
         {
             if (Math.Abs(n.time._miliseconds - _miliseconds) <= 27)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Пример #2
0
        private void btn_start_Click(object sender, EventArgs e)
        {
            IEnumerable <Note> notes    = midiObj.notes;
            TempoMap           tempoMap = midiObj.tempoMap;

            foreach (Note n in notes)
            {
                MetricTimeSpan metricTime = n.TimeAs <MetricTimeSpan>(tempoMap);

                NoteObj tmpNote =
                    new NoteObj(
                        new Point(
                            getNotePosition(n).X, 0), new MyTime(
                            metricTime.Minutes, metricTime.Seconds, metricTime.Milliseconds),
                        n.NoteName.ToString(),
                        getNoteWidth(n));
                listOfNotes.Add(tmpNote);
            }

            _minutes        = 0;
            _seconds        = 0;
            _miliseconds    = 0;
            hits            = 0;
            misses          = 0;
            lbl_hits.Text   = "Hits:  0";
            lbl_misses.Text = "Misses:  0";
            btn_openMidi.Hide();
            lbl_midiName.Hide();
            btn_start.Hide();
            enablePianoButtons();
            timerPiano.Start();
        }
Пример #3
0
 private void DrawNote()
 {
     if (listOfNotes.Count != 0)
     {
         NoteObj n = listOfNotes.First();
         if (compareTime(n))
         {
             noteDoc.AddNote(n);
             listOfNotes.RemoveAt(0);
         }
     }
     else
     {
         if (noteDoc.checkForLastAndStop())
         {
             disablePianoButtons();
             resetGame();
             timerPiano.Stop();
         }
     }
 }
Пример #4
0
 public void AddNote(NoteObj n)
 {
     notes.Add(n);
 }