| 1 | |
| 2 | /****************************************************************************** |
| 3 | ******************************************************************************* |
| 4 | |
| 5 | FAUST DSP |
| 6 | |
| 7 | ******************************************************************************* |
| 8 | *******************************************************************************/ |
| 9 | |
| 10 | #ifndef __dsp__ |
| 11 | #define __dsp__ |
| 12 | |
| 13 | #ifndef FAUSTFLOAT |
| 14 | #define FAUSTFLOAT float |
| 15 | #endif |
| 16 | |
| 17 | class UI; |
| 18 | |
| 19 | //---------------------------------------------------------------- |
| 20 | // signal processor definition |
| 21 | //---------------------------------------------------------------- |
| 22 | |
| 23 | class dsp { |
| 24 | protected: |
| 25 | int fSamplingFreq; |
| 26 | public: |
| 27 | dsp() {} |
| 28 | virtual ~dsp() {} |
| 29 | |
| 30 | virtual int getNumInputs() = 0; |
| 31 | virtual int getNumOutputs() = 0; |
| 32 | virtual void buildUserInterface(UI* interface) = 0; |
| 33 | virtual void init(int samplingRate) = 0; |
| 34 | virtual void instanceInit(int samplingFreq) = 0; |
| 35 | virtual void compute(int len, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) = 0; |
| 36 | }; |
| 37 | |
| 38 | // On Intel set FZ (Flush to Zero) and DAZ (Denormals Are Zero) |
| 39 | // flags to avoid costly denormals |
| 40 | #ifdef __SSE__ |
| 41 | #include <xmmintrin.h> |
| 42 | #ifdef __SSE2__ |
| 43 | #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8040) |
| 44 | #else |
| 45 | #define AVOIDDENORMALS _mm_setcsr(_mm_getcsr() | 0x8000) |
| 46 | #endif |
| 47 | #else |
| 48 | #define AVOIDDENORMALS |
| 49 | #endif |
| 50 | |
| 51 | #endif |