Audio software developers forum.
-
morana07
- Posts: 8
- Joined: Fri Sep 13, 2013 8:32 am
- Operating System: Please select
Post
by morana07 » Fri Sep 27, 2013 9:07 pm
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
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
-
steve
- Site Admin
- Posts: 81627
- Joined: Sat Dec 01, 2007 11:43 am
- Operating System: Linux *buntu
Post
by steve » Fri Sep 27, 2013 9:26 pm
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
Code: Select all
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;
}
Code: Select all
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;
}
-
morana07
- Posts: 8
- Joined: Fri Sep 13, 2013 8:32 am
- Operating System: Please select
Post
by morana07 » Sat Sep 28, 2013 12:39 am
Many thanks for the quick and informative reply!