Bill wrote:
> 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 ) ) );
> }
> }
While not exactly logarithmic, you can get a similar effect by taking
the square root of m_currentGain, assuming it's in the range of [0, 1]
(Where 0 means "no sound" and 1 means "full loudness").
Otherwise, you can just call logf with m_currentGain and be done with
it, but I'm not familiar with that function or its arguments, plus you'd
need some sort of offset to make it work, since log_n(0) is undefined.
Good luck.
-tom!
--


|