When have the reverb faded out?


#1

To avoid having to call reverb->processStereo() when there's nothing to process I have added  variable maxLevel like this

void processStereo (float* const left, float* const right, const int numSamples) noexcept
    {
        maxLevel = 0.0f;

        for (int i = 0; i < numSamples; ++i)
        {
             .
             .
            left[i]  = outL * wet1 + outR * wet2 + left[i]  * dry;
            right[i] = outR * wet1 + outL * wet2 + right[i] * dry;

            maxLevel = jmax(std::abs(left[i]), std::abs(right[i]), maxLevel);
        }
    }

When the synth have no more voices to play I check this maxLevel and when it reaches -80dB or so I stop calling reverb->processStereo() to save valuable processing time.

Is there a better way to do this?