mirror of
https://github.com/thestk/stk
synced 2026-01-14 05:21:53 +00:00
Version 4.3.0
This commit is contained in:
committed by
Stephen Sinclair
parent
2cbce2d8bd
commit
27d9b79dc7
@@ -19,12 +19,12 @@
|
||||
to \e keyOn and \e keyOff messages by ramping to
|
||||
1.0 on keyOn and to 0.0 on keyOff.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
#include "Asymp.h"
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
Asymp :: Asymp(void) : Envelope()
|
||||
{
|
||||
@@ -36,6 +36,14 @@ Asymp :: ~Asymp(void)
|
||||
{
|
||||
}
|
||||
|
||||
void Asymp :: sampleRateChanged( StkFloat newRate, StkFloat oldRate )
|
||||
{
|
||||
if ( !ignoreSampleRateChange_ ) {
|
||||
StkFloat tau = -1.0 / ( std::log( factor_ ) * oldRate );
|
||||
factor_ = std::exp( -1.0 / ( tau * newRate ) );
|
||||
}
|
||||
}
|
||||
|
||||
void Asymp :: keyOn(void)
|
||||
{
|
||||
Envelope::keyOn();
|
||||
@@ -56,7 +64,7 @@ void Asymp :: setTau(StkFloat tau)
|
||||
return;
|
||||
}
|
||||
|
||||
factor_ = exp( -1.0 / ( tau * Stk::sampleRate() ) );
|
||||
factor_ = std::exp( -1.0 / ( tau * Stk::sampleRate() ) );
|
||||
constant_ = ( 1.0 - factor_ ) * target_;
|
||||
}
|
||||
|
||||
@@ -68,8 +76,8 @@ void Asymp :: setTime(StkFloat time)
|
||||
return;
|
||||
}
|
||||
|
||||
StkFloat tau = -time / log( TARGET_THRESHOLD );
|
||||
factor_ = exp( -1.0 / ( tau * Stk::sampleRate() ) );
|
||||
StkFloat tau = -time / std::log( TARGET_THRESHOLD );
|
||||
factor_ = std::exp( -1.0 / ( tau * Stk::sampleRate() ) );
|
||||
constant_ = ( 1.0 - factor_ ) * target_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user