render method

void render(
  1. List<double> left,
  2. List<double> right
)

Implementation

void render(List<double> left, List<double> right) {
  if (left.length != right.length) {
    throw "The output buffers must be the same length.";
  }

  var wrote = 0;

  while (wrote < left.length) {
    if (_blockRead == blockSize) {
      _renderBlock();
      _blockRead = 0;
    }

    // remainder
    var srcRemainder = blockSize - _blockRead;
    var dstRemainder = left.length - wrote;
    var remainder = min(srcRemainder, dstRemainder);

    for (int i = 0; i < remainder; i++) {
      left[wrote + i] = _blockLeft[_blockRead + i];
      right[wrote + i] = _blockRight[_blockRead + i];
    }

    _blockRead += remainder;
    wrote += remainder;
  }
}