~ubuntu-branches/ubuntu/oneiric/muse/oneiric

« back to all changes in this revision

Viewing changes to synti/stklib/JetTabl.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**********************************************/
 
2
/* Jet Table Object by Perry R. Cook, 1995-96 */
 
3
/* Consult Fletcher and Rossing, Karjalainen, */
 
4
/*       Cook, more, for information.         */
 
5
/* This, as with many other of my "tables",   */
 
6
/* is not a table, but is computed by poly-   */
 
7
/* nomial calculation.                        */
 
8
/**********************************************/
 
9
 
 
10
#include "JetTabl.h"
 
11
 
 
12
JetTabl :: JetTabl()
 
13
{
 
14
  lastOutput = (MY_FLOAT) 0.0;
 
15
}
 
16
 
 
17
JetTabl :: ~JetTabl()
 
18
{
 
19
}
 
20
 
 
21
MY_FLOAT JetTabl :: lookup(MY_FLOAT sample)
 
22
{
 
23
  return this->tick(sample);
 
24
}
 
25
 
 
26
MY_FLOAT JetTabl :: tick(MY_FLOAT sample)
 
27
  // Perform "Table Lookup"
 
28
  // By Polynomial Calculation
 
29
{
 
30
  // (x^3 - x) approximates sigmoid of jet
 
31
  lastOutput = sample * (sample*sample - (MY_FLOAT)  1.0);
 
32
  if (lastOutput > 1.0) 
 
33
    lastOutput = (MY_FLOAT) 1.0; // Saturation at +/- 1.0
 
34
  if (lastOutput < -1.0)
 
35
    lastOutput = (MY_FLOAT) -1.0; 
 
36
  return lastOutput;
 
37
}
 
38
 
 
39
MY_FLOAT JetTabl :: lastOut()
 
40
{
 
41
  return lastOutput;
 
42
}
 
43