Version 4.4.0

This commit is contained in:
Gary Scavone
2013-09-29 23:11:39 +02:00
committed by Stephen Sinclair
parent d199342e86
commit eccd8c9981
287 changed files with 11712 additions and 7676 deletions

View File

@@ -2,60 +2,45 @@
/*! \class Chorus
\brief STK chorus effect class.
This class implements a chorus effect.
This class implements a chorus effect. It takes a monophonic
input signal and produces a stereo output signal.
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
*/
/***************************************************/
#include "Chorus.h"
#include <iostream>
Chorus :: Chorus(StkFloat baseDelay)
namespace stk {
Chorus :: Chorus( StkFloat baseDelay )
{
lastFrame_.resize( 1, 2, 0.0 ); // resize lastFrame_ for stereo output
delayLine_[0].setMaximumDelay( (unsigned long) (baseDelay * 1.414) + 2);
delayLine_[0].setDelay( baseDelay );
delayLine_[1].setMaximumDelay( (unsigned long) (baseDelay * 1.414) + 2);
delayLine_[1].setDelay( baseDelay );
baseLength_ = baseDelay;
mods_[0].setFrequency(0.2);
mods_[1].setFrequency(0.222222);
mods_[0].setFrequency( 0.2 );
mods_[1].setFrequency( 0.222222 );
modDepth_ = 0.05;
effectMix_ = 0.5;
this->clear();
}
Chorus :: ~Chorus()
{
}
void Chorus :: clear()
void Chorus :: clear( void )
{
delayLine_[0].clear();
delayLine_[1].clear();
lastOutput_[0] = 0.0;
lastOutput_[1] = 0.0;
lastFrame_[0] = 0.0;
lastFrame_[1] = 0.0;
}
void Chorus :: setModDepth(StkFloat depth)
void Chorus :: setModFrequency( StkFloat frequency )
{
modDepth_ = depth;
mods_[0].setFrequency( frequency );
mods_[1].setFrequency( frequency * 1.1111 );
}
void Chorus :: setModFrequency(StkFloat frequency)
{
mods_[0].setFrequency(frequency);
mods_[1].setFrequency(frequency * 1.1111);
}
StkFloat Chorus :: computeSample(StkFloat input)
{
delayLine_[0].setDelay( baseLength_ * 0.707 * (1.0 + modDepth_ * mods_[0].tick()) );
delayLine_[1].setDelay( baseLength_ * 0.5 * (1.0 - modDepth_ * mods_[1].tick()) );
lastOutput_[0] = input * (1.0 - effectMix_);
lastOutput_[0] += effectMix_ * delayLine_[0].tick(input);
lastOutput_[1] = input * (1.0 - effectMix_);
lastOutput_[1] += effectMix_ * delayLine_[1].tick(input);
return Effect::lastOut();
}
} // stk namespace