Test commit into the README file.
[Faustine.git] / dsp_files / sin.17.tmp.cpp
1 //-----------------------------------------------------
2 //
3 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
4 //-----------------------------------------------------
5 #ifndef FAUSTFLOAT
6 #define FAUSTFLOAT float
7 #endif
8
9 typedef long double quad;
10 /* link with */
11
12 #ifndef FAUSTCLASS
13 #define FAUSTCLASS mydsp
14 #endif
15
16 class mydsp : public dsp {
17 private:
18 class SIG0 {
19 private:
20 int fSamplingFreq;
21 int iRec0[2];
22 public:
23 int getNumInputs() { return 0; }
24 int getNumOutputs() { return 1; }
25 void init(int samplingFreq) {
26 fSamplingFreq = samplingFreq;
27 for (int i=0; i<2; i++) iRec0[i] = 0;
28 }
29 void fill (int count, float output[]) {
30 for (int i=0; i<count; i++) {
31 iRec0[0] = (1 + iRec0[1]);
32 output[i] = sinf((0.00015707963267945f * (iRec0[0] - 1)));
33 // post processing
34 iRec0[1] = iRec0[0];
35 }
36 }
37 };
38
39
40 static float ftbl0[40000];
41 float fVec0[2];
42 float fRec1[2];
43 public:
44 static void metadata(Meta* m) {
45 }
46
47 virtual int getNumInputs() { return 0; }
48 virtual int getNumOutputs() { return 1; }
49 static void classInit(int samplingFreq) {
50 SIG0 sig0;
51 sig0.init(samplingFreq);
52 sig0.fill(40000,ftbl0);
53 }
54 virtual void instanceInit(int samplingFreq) {
55 fSamplingFreq = samplingFreq;
56 for (int i=0; i<2; i++) fVec0[i] = 0;
57 for (int i=0; i<2; i++) fRec1[i] = 0;
58 }
59 virtual void init(int samplingFreq) {
60 classInit(samplingFreq);
61 instanceInit(samplingFreq);
62 }
63 virtual void buildUserInterface(UI* interface) {
64 interface->openVerticalBox("sin.17.tmp");
65 interface->closeBox();
66 }
67 virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT** output) {
68 FAUSTFLOAT* output0 = output[0];
69 for (int i=0; i<count; i++) {
70 fVec0[0] = 0.022675736961451247f;
71 float fTemp0 = (fVec0[1] + fRec1[1]);
72 fRec1[0] = (fTemp0 - floorf(fTemp0));
73 output0[i] = (FAUSTFLOAT)ftbl0[int((40000 * fRec1[0]))];
74 // post processing
75 fRec1[1] = fRec1[0];
76 fVec0[1] = fVec0[0];
77 }
78 }
79 };
80
81
82 float mydsp::ftbl0[40000];