mirror of
https://github.com/thestk/stk
synced 2026-01-12 12:31:53 +00:00
Version 4.4.3
This commit is contained in:
committed by
Stephen Sinclair
parent
baca57040b
commit
0aec39260a
@@ -7,7 +7,7 @@
|
||||
specified \e rate. It also responds to simple \e keyOn and \e
|
||||
keyOff messages, ramping to 1.0 on keyOn and to 0.0 on keyOff.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -47,4 +47,38 @@ void Envelope :: sampleRateChanged( StkFloat newRate, StkFloat oldRate )
|
||||
rate_ = oldRate * rate_ / newRate;
|
||||
}
|
||||
|
||||
void Envelope :: setRate( StkFloat rate )
|
||||
{
|
||||
if ( rate < 0.0 ) {
|
||||
oStream_ << "Envelope::setRate: argument must be >= 0.0!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
rate_ = rate;
|
||||
}
|
||||
|
||||
void Envelope :: setTime( StkFloat time )
|
||||
{
|
||||
if ( time <= 0.0 ) {
|
||||
oStream_ << "Envelope::setTime: argument must be > 0.0!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
rate_ = 1.0 / ( time * Stk::sampleRate() );
|
||||
}
|
||||
|
||||
void Envelope :: setTarget( StkFloat target )
|
||||
{
|
||||
target_ = target;
|
||||
if ( value_ != target_ ) state_ = 1;
|
||||
}
|
||||
|
||||
void Envelope :: setValue( StkFloat value )
|
||||
{
|
||||
state_ = 0;
|
||||
target_ = value;
|
||||
value_ = value;
|
||||
lastFrame_[0] = value_;
|
||||
}
|
||||
|
||||
} // stk namespace
|
||||
|
||||
Reference in New Issue
Block a user