start method

Future<RoundResult?> start()

Começa a rodada: a contagem, a forma, e o resultado quando ela acaba. null se cancel antes disso.

Implementation

Future<RoundResult?> start() {
  final round = _round;
  final clock = _clock;
  final done = _done;
  if (round == null || clock == null || done == null) {
    throw StateError('chame load() antes de start()');
  }
  if (_previewed) {
    _previewed = false;
    engine.allNotesOff();
    engine.clearScheduled();
  }
  clock.anchor(
    -round.countInBars * round.beatsPerBar.toDouble(),
    engine.earliestScheduleSeconds + startLeadSeconds,
  );
  _sendPrograms(round);
  _listen();
  pump();
  _armTimer();
  return done.future;
}