1 //-----------------------------------------------------
3 // Code generated with Faust 0.9.58 (http://faust.grame.fr)
4 //-----------------------------------------------------
6 #define FAUSTFLOAT float
9 typedef long double quad
;
13 #define FAUSTCLASS mydsp
16 class mydsp
: public dsp
{
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;
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)));
40 static float ftbl0
[40000];
44 static void metadata(Meta
* m
) {
47 virtual int getNumInputs() { return 0; }
48 virtual int getNumOutputs() { return 1; }
49 static void classInit(int samplingFreq
) {
51 sig0
.init(samplingFreq
);
52 sig0
.fill(40000,ftbl0
);
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;
59 virtual void init(int samplingFreq
) {
60 classInit(samplingFreq
);
61 instanceInit(samplingFreq
);
63 virtual void buildUserInterface(UI
* interface
) {
64 interface
->openVerticalBox("sin.17.tmp");
65 interface
->closeBox();
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]))];
82 float mydsp::ftbl0
[40000];