コード例 #1
0
        private void PlayNotes(int x)
        {
            int absX = currentX + x;

            for (int i = 0; i < currentNotes.Count; i++)
            {
                Note no    = currentNotes[i];
                int  noteX = no.AbsoluteX + (int)no.Length;
                if (noteX <= absX)
                {
                    StopNote(no);
                    SoundHelper.Cleanup();
                    currentNotes.RemoveAt(i--);

                    windowLeerlingController.LightDown(no.Octave, no.Letter.ToString(), no.Black);
                }
            }

            if (absX >= CurrentSong.GetXPerMeasure() * CurrentSong.Measures.Count)
            {
                if (currentNotes.Count == 0)
                {
                    Stop();
                    windowLeerlingController.SongFinished();
                }
                return;
            }


            for (int i = currentX; i < currentX + x; i++)
            {
                var songComponentsIsDat = CurrentSong.GetSongComponentsAtX(i);
                foreach (var temp in songComponentsIsDat)
                {
                    if (temp is Note)
                    {
                        Note no = (Note)temp;
                        no.AbsoluteX = i;

                        PlayNote(no);
                        currentNotes.Add(no);

                        if (windowLeerlingController != null)
                        {
                            windowLeerlingController.LightUp(no.Octave, no.Letter.ToString(), no.Black);
                        }
                    }
                }
            }
            currentX += x;
        }