process method

void process()

Implementation

void process()
{
    if (!_active)
    {
        return;
    }

    _processedSampleCount += synthesizer.blockSize;

    var currentTime = _processedSampleCount / synthesizer.sampleRate;

    if (currentTime < _delay)
    {
        _value = 0;
    }
    else
    {
        var phase = ((currentTime - _delay) % _period) / _period;
        if (phase < 0.25)
        {
            _value = 4 * phase;
        }
        else if (phase < 0.75)
        {
            _value = 4 * (0.5 - phase);
        }
        else
        {
            _value = 4 * (phase - 1.0);
        }
    }
}