34 "category",
"Generators",
35 "description",
"ADSR",
38 static FactoryRegistrator<ProcessingFactory, ADSR>
reg =
metadata;
51 SetSampleRate( 8000 );
55 : mOutput(
"Audio Output",this)
56 , mAmplitude(
"Amplitude",this, &
ADSR::UpdateAmp )
61 , mState(
"State", this )
70 mAttackTime = mConfig.GetAttackTime();
71 mDecayTime = mConfig.GetDecayTime();
72 mSustainLevel = mConfig.GetSustainLevel();
73 mReleaseTime = mConfig.GetReleaseTime();
74 mSamplingRate = mConfig.GetSampleRate();
83 mDLevel = mAmpValue / ( mAttackTime * mSamplingRate );
89 mDLevel = ( mSustainLevel * mAmpValue - mAmpValue ) / ( mDecayTime * mSamplingRate ) ;
95 mDLevel = - mLevel / ( mReleaseTime * mSamplingRate );
133 TData* ptr = out.GetBuffer().GetPtr();
138 while ( ptr!=endptr )
143 if (mLevel >= mAmpValue)
153 while ( ptr!=endptr )
158 if (mLevel <= mSustainLevel )
168 while ( ptr!=endptr )
175 while ( ptr!=endptr )
191 while ( ptr!=endptr )