Initial import.
[Faustine.git] / dsp_files / square.21.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 int iRec0[2];
19 public:
20 static void metadata(Meta* m) {
21 }
22
23 virtual int getNumInputs() { return 0; }
24 virtual int getNumOutputs() { return 1; }
25 static void classInit(int samplingFreq) {
26 }
27 virtual void instanceInit(int samplingFreq) {
28 fSamplingFreq = samplingFreq;
29 for (int i=0; i<2; i++) iRec0[i] = 0;
30 }
31 virtual void init(int samplingFreq) {
32 classInit(samplingFreq);
33 instanceInit(samplingFreq);
34 }
35 virtual void buildUserInterface(UI* interface) {
36 interface->openVerticalBox("square.21.tmp");
37 interface->closeBox();
38 }
39 virtual void compute (int count, FAUSTFLOAT** input, FAUSTFLOAT** output) {
40 FAUSTFLOAT* output0 = output[0];
41 for (int i=0; i<count; i++) {
42 iRec0[0] = (1 + (iRec0[1] % 441));
43 output0[i] = (FAUSTFLOAT)((2 * ((iRec0[0] - 1) > 220.5f)) - 1);
44 // post processing
45 iRec0[1] = iRec0[0];
46 }
47 }
48 };
49
50