noteOff method

ChordAttempt? noteOff(
  1. int pitch,
  2. double atMs
)

Uma tecla solta. Com todas soltas, fecha a tentativa errada (ou certa, se o conjunto casou e foi solto antes do holdMs), desde que tenha duas notas ou mais.

Implementation

ChordAttempt? noteOff(int pitch, double atMs) {
  _held.remove(pitch);
  _matchedSince = _matches() ? (_matchedSince ?? atMs) : null;
  if (_held.isNotEmpty) return null;
  final largest = _largest;
  _largest = {};
  _matchedSince = null;
  if (largest.length < 2) return null;
  final pitches = largest.toList()..sort();
  return ChordAttempt(
    pitches,
    checkPlayChord(pitches, _target, previous: _previous),
  );
}