Example #1
0
        public void createNode(int x1, int x2, List <Note> nodeNotes, Song song)
        {
            leftBound  = x1;
            rightBound = x2;
            notes      = nodeNotes;
            int middle = (x2 + x1) / 2;

            if (notes.Count == 0 || middle - x1 < 4 * song.TicksPerBeat)
            {
                return;
            }
            List <Note> leftNoteList  = new List <Note>();
            List <Note> rightNoteList = new List <Note>();

            foreach (Note note in nodeNotes)
            {
                if (note.start < middle && note.stop > x1)
                {
                    leftNoteList.Add(note);
                }
                if (note.start < x2 && note.stop > middle)
                {
                    rightNoteList.Add(note);
                }
            }
            leftNode = new NoteBsp();
            leftNode.createNode(x1, middle, leftNoteList, song);
            rightNode = new NoteBsp();
            rightNode.createNode(middle, x2, rightNoteList, song);
        }
Example #2
0
 public List <Note> getNotes(int x1, int x2, int minPitch, int maxPitch)
 {
     if (x2 < 0 || x1 > Length)
     {
         return(new List <Note>());
     }
     if (x1 < 0)
     {
         x1 = 0;
     }
     if (x2 >= Length)
     {
         x2 = Length - 1;
     }
     return(NoteBsp.getNotes(x1, x2, minPitch, maxPitch));
 }