Linear fade-out

Dear forum members,

I have a short question regarding the built-in linear fade in/out.
I tried to find the fade code in the archive, but drowned in the numerous threads :slight_smile:
I would be happy to see the code if someone has easy access to it, otherwise, I would like to know if the linear function is applied to the intensity, i.e. it’s the db measure that gets linearly changed.

Many thanks,
Moran

The linear function is applied to the sample value, thus to the linear scale level, not “dB” (which would be an exponential fade).

The code is in /src/effects/Fade.cpp

bool EffectFadeIn::ProcessSimpleMono(float *buffer, sampleCount len)
{
   for (sampleCount i = 0; i < len; i++)
      buffer[i] = (float) (buffer[i] * (float) (mSample + i)
                           / (float) (mLen));
   mSample += len;

   return true;
}



bool EffectFadeOut::ProcessSimpleMono(float *buffer, sampleCount len)
{
   for (sampleCount i = 0; i < len; i++)
      buffer[i] = (float) (buffer[i]
                           * (float) (mLen - 1 - (mSample + i))
                           / (float) (mLen));
   mSample += len;

   return true;
}

Many thanks for the quick and informative reply!