20const int maxDelay = 5024;
35 StkFloat
lastOut(
void )
const {
return lastFrame_[0]; };
38 StkFloat
tick( StkFloat input );
68 unsigned long delayLength_;
69 unsigned long halfLength_;
73inline StkFloat PitShift :: tick( StkFloat input )
78 while ( delay_[0] > maxDelay-12 ) delay_[0] -= delayLength_;
79 while ( delay_[0] < 12 ) delay_[0] += delayLength_;
81 delay_[1] = delay_[0] + halfLength_;
82 while ( delay_[1] > maxDelay-12 ) delay_[1] -= delayLength_;
83 while ( delay_[1] < 12 ) delay_[1] += delayLength_;
89 env_[1] = fabs( ( delay_[0] - halfLength_ + 12 ) * ( 1.0 / (halfLength_ + 12 ) ) );
90 env_[0] = 1.0 - env_[1];
93 lastFrame_[0] = env_[1] * delayLine_.tapOut( delay_[1] );
94 lastFrame_[0] = +env_[0] * delayLine_.tick( input );
97 lastFrame_[0] *= effectMix_;
98 lastFrame_[0] += ( 1.0 - effectMix_ ) * input;
100 return lastFrame_[0];
STK linear interpolating delay line class.
Definition DelayL.h:28
void setDelay(StkFloat delay)
Set the delay-line length.
Definition DelayL.h:136
STK abstract effects parent class.
Definition Effect.h:22
STK simple pitch shifter effect class.
Definition PitShift.h:23
StkFloat lastOut(void) const
Return the last computed output value.
Definition PitShift.h:35
void setShift(StkFloat shift)
Set the pitch shift factor (1.0 produces no shift).
StkFloat tick(StkFloat input)
Input one sample to the effect and return one output.
Definition PitShift.h:73
StkFrames & tick(StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0, unsigned int oChannel=0)
Take a channel of the iFrames object as inputs to the effect and write outputs to the oFrames object.
StkFrames & tick(StkFrames &frames, unsigned int channel=0)
Take a channel of the StkFrames object as inputs to the effect and replace with corresponding outputs...
PitShift(void)
Class constructor.
void clear(void)
Reset and clear all internal state.
An STK class to handle vectorized audio data.
Definition Stk.h:279
The STK namespace.
Definition ADSR.h:6