Files
stk/src/JetTable.cpp
Gary Scavone 27d9b79dc7 Version 4.3.0
2013-09-29 23:07:00 +02:00

40 lines
966 B
C++

/***************************************************/
/*! \class JetTable
\brief STK jet table class.
This class implements a flue jet non-linear
function, computed by a polynomial calculation.
Contrary to the name, this is not a "table".
Consult Fletcher and Rossing, Karjalainen,
Cook, and others for more information.
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
*/
/***************************************************/
#include "JetTable.h"
JetTable :: JetTable() : Function()
{
}
JetTable :: ~JetTable()
{
}
StkFloat JetTable :: computeSample( StkFloat input )
{
// Perform "table lookup" using a polynomial
// calculation (x^3 - x), which approximates
// the jet sigmoid behavior.
lastOutput_ = input * (input * input - (StkFloat) 1.0);
// Saturate at +/- 1.0.
if (lastOutput_ > 1.0)
lastOutput_ = (StkFloat) 1.0;
if (lastOutput_ < -1.0)
lastOutput_ = (StkFloat) -1.0;
return lastOutput_;
}