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)); }
public List <Note> getNotes(int x1, int x2, int minPitch, int maxPitch) { if (leftNode != null && leftNode.leftBound <= x1 && leftNode.rightBound >= x2) { return(leftNode.getNotes(x1, x2, minPitch, maxPitch)); } else if (rightNode != null && rightNode.leftBound <= x1 && rightNode.rightBound >= x2) { return(rightNode.getNotes(x1, x2, minPitch, maxPitch)); } else { List <Note> selectedNotes = new List <Note>(); foreach (Note note in notes) { if (note.pitch >= minPitch && note.pitch <= maxPitch && note.start < x2 && note.stop > x1) { selectedNotes.Add(note); } } return(selectedNotes); } }