process method

void process({
  1. required List<double> inputLeft,
  2. required List<double> inputRight,
  3. required List<double> outputLeft,
  4. required List<double> outputRight,
})

Implementation

void process({required List<double> inputLeft,
              required List<double> inputRight,
              required List<double> outputLeft,
              required List<double> outputRight})
{
    for (int t = 0; t < outputLeft.length; t++)
    {
        double position = _bufferIndexL - _delayTable[_delayTableIndexL];
        if (position < 0.0)
        {
            position += _bufferL.length;
        }

        int index1 = position.toInt();
        int index2 = index1 + 1;

        if (index2 == _bufferL.length)
        {
            index2 = 0;
        }

        double x1 = _bufferL[index1];
        double x2 = _bufferL[index2];
        double a = position - index1;
        outputLeft[t] = x1 + a * (x2 - x1);

        _bufferL[_bufferIndexL] = inputLeft[t];
        _bufferIndexL++;
        if (_bufferIndexL == _bufferL.length)
        {
            _bufferIndexL = 0;
        }

        _delayTableIndexL++;
        if (_delayTableIndexL == _delayTable.length)
        {
            _delayTableIndexL = 0;
        }
    }

    for (int t = 0; t < outputRight.length; t++)
    {
        double position = _bufferIndexR - _delayTable[_delayTableIndexR];
        if (position < 0.0)
        {
            position += _bufferR.length;
        }

        int index1 = position.toInt();
        int index2 = index1 + 1;

        if (index2 == _bufferR.length)
        {
            index2 = 0;
        }

        double x1 = _bufferR[index1];
        double x2 = _bufferR[index2];
        double a = position - index1;
        outputRight[t] = x1 + a * (x2 - x1);

        _bufferR[_bufferIndexR] = inputRight[t];
        _bufferIndexR++;
        if (_bufferIndexR == _bufferR.length)
        {
            _bufferIndexR = 0;
        }

        _delayTableIndexR++;
        if (_delayTableIndexR == _delayTable.length)
        {
            _delayTableIndexR = 0;
        }
    }
}