Hi,
I have written a small c++ audio library that supports basic
functionality including linear fading in and out of gain. I would like
to implement logarithmic fading instead of linear but I do not know how
to go about it. Here is the update fade function which gets called on
every frame, can anyone suggest some code I can use to replace my linear
solution?, thanks
void Sound::Fade::Update( void )
{
const double elapsedFadeTime( GetTickCount() - m_startTime );
if( elapsedFadeTime > m_duration )
{
m_duration = 0;
m_currentGain = m_endGain;
}
else
{
m_currentGain = static_cast<float>( m_beginGain + ( (
elapsedFadeTime / m_duration ) * ( m_endGain - m_beginGain ) ) );
}
}