answerChord method

ChordCheck? answerChord(
  1. Iterable<int> held, {
  2. NoteNaming naming = NoteNaming.latin,
  3. bool byEar = false,
})

Resposta no teclado MIDI, no treino de acordes: held são as notas apertadas agora. Certo avança; errado perde a primeira tentativa e a pergunta segue; incompleto (faltam notas) não conta nada. Devolve o que a conferência achou, ou null se foi ignorada (revelando, terminou ou a pergunta não é de acorde).

Implementation

ChordCheck? answerChord(
  Iterable<int> held, {
  NoteNaming naming = NoteNaming.latin,
  bool byEar = false,
}) {
  if (done || revealing) return null;
  final target = questions[index].chord;
  if (target == null) return null;
  final check = target.check(held, naming: naming, byEar: byEar);
  switch (check.verdict) {
    case ChordVerdict.right:
      index++;
      revealing = false;
      if (!done) _startAt = _lastTick ?? _now();
    case ChordVerdict.wrong:
      _markWrong();
    case ChordVerdict.incomplete:
      break;
  }
  return check;
}