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. Retursn 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;
}