contains method

bool contains(
  1. int key,
  2. int velocity
)

Checks if the region covers the given key and velocity. arg: The key of a note. arg: The velocity of a note return true if the region covers the given key and velocity.

Implementation

bool contains(int key, int velocity) {
  bool containsKey = keyRangeStart() <= key && key <= keyRangeEnd();
  bool containsVelocity =
      velocityRangeStart() <= velocity && velocity <= velocityRangeEnd();
  return containsKey && containsVelocity;
}