[Stk] Bug in decay of envelope?
Michael Bechard
gothmagog at yahoo.com
Sun Feb 13 10:45:01 PST 2011
When I set the decay time of an envelope, it doesn't take the full amount of
time to decay to the sustain level. I think the problem is with this code:
void ADSR :: setDecayTime( StkFloat time )
{
if ( time < 0.0 ) {
errorString_ << "ADSR::setDecayTime: negative times not allowed ...
correcting!";
handleError( StkError::WARNING );
decayRate_ = 1.0 / ( -time * Stk::sampleRate() );
}
else decayRate_ = 1.0 / ( time * Stk::sampleRate() );
}
...should possibly be...
void ADSR :: setDecayTime( StkFloat time )
{
if ( time < 0.0 ) {
errorString_ << "ADSR::setDecayTime: negative times not allowed ...
correcting!";
handleError( StkError::WARNING );
decayRate_ = 1.0 / ( -time * Stk::sampleRate() );
}
else decayRate_ = (1.0 - sustainLevel_) / ( time * Stk::sampleRate() );
}
Am I on crack or is this correct?
Thanks,
Michael Bechard
More information about the Stk
mailing list