50 void setStates( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
53 void setTargets( StkFloat frequency, StkFloat radius, StkFloat gain = 1.0 );
75 StkFloat
lastOut(
void )
const {
return lastFrame_[0]; };
78 StkFloat
tick( StkFloat input );
104 virtual void sampleRateChanged( StkFloat newRate, StkFloat oldRate );
109 StkFloat startFrequency_;
110 StkFloat startRadius_;
112 StkFloat targetFrequency_;
113 StkFloat targetRadius_;
114 StkFloat targetGain_;
115 StkFloat deltaFrequency_;
116 StkFloat deltaRadius_;
118 StkFloat sweepState_;
126 sweepState_ += sweepRate_;
127 if ( sweepState_ >= 1.0 ) {
130 radius_ = targetRadius_;
131 frequency_ = targetFrequency_;
135 radius_ = startRadius_ + (deltaRadius_ * sweepState_);
136 frequency_ = startFrequency_ + (deltaFrequency_ * sweepState_);
137 gain_ = startGain_ + (deltaGain_ * sweepState_);
142 inputs_[0] = gain_ * input;
143 lastFrame_[0] = b_[0] * inputs_[0] + b_[1] * inputs_[1] + b_[2] * inputs_[2];
144 lastFrame_[0] -= a_[2] * outputs_[2] + a_[1] * outputs_[1];
145 inputs_[2] = inputs_[1];
146 inputs_[1] = inputs_[0];
147 outputs_[2] = outputs_[1];
148 outputs_[1] = lastFrame_[0];
150 return lastFrame_[0];
155 #if defined(_STK_DEBUG_)
156 if ( channel >= frames.
channels() ) {
157 oStream_ <<
"FormSwep::tick(): channel and StkFrames arguments are incompatible!";
162 StkFloat *samples = &frames[channel];
163 unsigned int hop = frames.
channels();
164 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
165 *samples =
tick( *samples );
172 #if defined(_STK_DEBUG_)
174 oStream_ <<
"FormSwep::tick(): channel and StkFrames arguments are incompatible!";
179 StkFloat *iSamples = &iFrames[iChannel];
180 StkFloat *oSamples = &oFrames[oChannel];
182 for (
unsigned int i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop )
183 *oSamples =
tick( *iSamples );
STK abstract filter class.
Definition: Filter.h:23
An STK class to handle vectorized audio data.
Definition: Stk.h:287
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition: Stk.h:415
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition: Stk.h:418
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
The STK namespace.
Definition: ADSR.h:8