38 Twang( StkFloat lowestFrequency = 50.0 );
74 StkFloat
lastOut(
void ) {
return lastOutput_; };
77 StkFloat
tick( StkFloat input );
107 StkFloat lastOutput_;
110 StkFloat pluckPosition_;
113inline StkFloat Twang :: tick( StkFloat input )
115 lastOutput_ = delayLine_.
tick( input + loopFilter_.tick( delayLine_.lastOut() ) );
116 lastOutput_ -= combDelay_.tick( lastOutput_ );
124#if defined(_STK_DEBUG_)
125 if ( channel >= frames.
channels() ) {
126 oStream_ <<
"Twang::tick(): channel and StkFrames arguments are incompatible!";
127 handleError( StkError::FUNCTION_ARGUMENT );
131 StkFloat *samples = &frames[channel];
132 unsigned int hop = frames.
channels();
133 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
134 *samples = tick( *samples );
141#if defined(_STK_DEBUG_)
143 oStream_ <<
"Twang::tick(): channel and StkFrames arguments are incompatible!";
144 handleError( StkError::FUNCTION_ARGUMENT );
148 StkFloat *iSamples = &iFrames[iChannel];
149 StkFloat *oSamples = &oFrames[oChannel];
151 for (
unsigned int i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop )
152 *oSamples = tick( *iSamples );
STK allpass interpolating delay line class.
Definition DelayA.h:29
STK linear interpolating delay line class.
Definition DelayL.h:28
STK general finite impulse response filter class.
Definition Fir.h:31
StkFloat tick(StkFloat input)
Input one sample to the filter and return one output.
Definition Fir.h:86
An STK class to handle vectorized audio data.
Definition Stk.h:279
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition Stk.h:416
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition Stk.h:419
STK base class.
Definition Stk.h:136
STK enhanced plucked string class.
Definition Twang.h:35
void setFrequency(StkFloat frequency)
Set the delayline parameters for a particular frequency.
StkFloat tick(StkFloat input)
Compute and return one output sample.
Definition Twang.h:113
void setPluckPosition(StkFloat position)
Set the pluck or "excitation" position along the string (0.0 - 1.0).
void setLoopFilter(std::vector< StkFloat > coefficients)
Set the loop filter coefficients.
void clear(void)
Reset and clear all internal state.
Twang(StkFloat lowestFrequency=50.0)
Class constructor, taking the lowest desired playing frequency.
StkFloat lastOut(void)
Return an StkFrames reference to the last output sample frame.
Definition Twang.h:74
void setLoopGain(StkFloat loopGain)
Set the nominal loop gain.
void setLowestFrequency(StkFloat frequency)
Set the delayline parameters to allow frequencies as low as specified.
The STK namespace.
Definition ADSR.h:6