updateRowActivity method

void updateRowActivity(
  1. int rowId,
  2. int activeChars
)

Reports current activity for a specific row.

When a row finishes all its flips, it MUST call this with activeChars = 0 to signal completion. The engine uses these reports to compute global density and will hard-stop all audio when every row reports zero.

Implementation

void updateRowActivity(int rowId, int activeChars) {
  if (!_isInitialized) return;

  final int oldVal = _rowActivity[rowId] ?? 0;
  if (activeChars > 0) {
    _rowActivity[rowId] = activeChars;
  } else {
    _rowActivity.remove(rowId);
  }

  _activeUnits += (activeChars - oldVal);
  // Hard clamp to zero just in case of weird drift
  if (_activeUnits < 0) _activeUnits = 0;

  _updateAmbientMix();
}