mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
44 lines
1005 B
C++
44 lines
1005 B
C++
/**********************************************/
|
|
/* Jet Table Object by Perry R. Cook, 1995-96 */
|
|
/* Consult Fletcher and Rossing, Karjalainen, */
|
|
/* Cook, more, for information. */
|
|
/* This, as with many other of my "tables", */
|
|
/* is not a table, but is computed by poly- */
|
|
/* nomial calculation. */
|
|
/**********************************************/
|
|
|
|
#include "JetTabl.h"
|
|
|
|
JetTabl :: JetTabl()
|
|
{
|
|
lastOutput = (MY_FLOAT) 0.0;
|
|
}
|
|
|
|
JetTabl :: ~JetTabl()
|
|
{
|
|
}
|
|
|
|
MY_FLOAT JetTabl :: lookup(MY_FLOAT sample)
|
|
{
|
|
return this->tick(sample);
|
|
}
|
|
|
|
MY_FLOAT JetTabl :: tick(MY_FLOAT sample)
|
|
// Perform "Table Lookup"
|
|
// By Polynomial Calculation
|
|
{
|
|
// (x^3 - x) approximates sigmoid of jet
|
|
lastOutput = sample * (sample*sample - (MY_FLOAT) 1.0);
|
|
if (lastOutput > 1.0)
|
|
lastOutput = (MY_FLOAT) 1.0; // Saturation at +/- 1.0
|
|
if (lastOutput < -1.0)
|
|
lastOutput = (MY_FLOAT) -1.0;
|
|
return lastOutput;
|
|
}
|
|
|
|
MY_FLOAT JetTabl :: lastOut()
|
|
{
|
|
return lastOutput;
|
|
}
|
|
|