Created
December 3, 2025 18:45
-
-
Save sletz/262e7fc899ec34679c11bd38d1fdd46f to your computer and use it in GitHub Desktop.
Cloning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* ------------------------------------------------------------ | |
| name: "organ" | |
| Code generated with Faust 2.82.4 (https://faust.grame.fr) | |
| Compilation options: -lang cpp -ct 1 -es 1 -mcd 16 -mdd 1024 -mdy 33 -single -ftz 0 | |
| ------------------------------------------------------------ */ | |
| #ifndef __mydsp_H__ | |
| #define __mydsp_H__ | |
| #ifndef FAUSTFLOAT | |
| #define FAUSTFLOAT float | |
| #endif | |
| #include <algorithm> | |
| #include <cmath> | |
| #include <cstdint> | |
| #ifndef FAUSTCLASS | |
| #define FAUSTCLASS mydsp | |
| #endif | |
| #ifdef __APPLE__ | |
| #define exp10f __exp10f | |
| #define exp10 __exp10 | |
| #endif | |
| #if defined(_WIN32) | |
| #define RESTRICT __restrict | |
| #else | |
| #define RESTRICT __restrict__ | |
| #endif | |
| class mydsp : public dsp { | |
| private: | |
| int fSampleRate; | |
| public: | |
| mydsp() { | |
| } | |
| mydsp(const mydsp&) = default; | |
| mydsp& operator=(const mydsp&) = default; | |
| void metadata(Meta* m) { | |
| m->declare("compile_options", "-lang wasm -double -cn TOTO"); | |
| m->declare("filename", "organ.dsp"); | |
| m->declare("name", "organ"); | |
| } | |
| virtual int getNumInputs() { | |
| return 2; | |
| } | |
| virtual int getNumOutputs() { | |
| return 1; | |
| } | |
| static void classInit(int sample_rate) { | |
| } | |
| virtual void instanceConstants(int sample_rate) { | |
| fSampleRate = sample_rate; | |
| } | |
| virtual void instanceResetUserInterface() { | |
| } | |
| virtual void instanceClear() { | |
| } | |
| virtual void init(int sample_rate) { | |
| classInit(sample_rate); | |
| instanceInit(sample_rate); | |
| } | |
| virtual void instanceInit(int sample_rate) { | |
| instanceConstants(sample_rate); | |
| instanceResetUserInterface(); | |
| instanceClear(); | |
| } | |
| virtual mydsp* clone() { | |
| return new mydsp(*this); | |
| } | |
| virtual int getSampleRate() { | |
| return fSampleRate; | |
| } | |
| virtual void buildUserInterface(UI* ui_interface) { | |
| ui_interface->openVerticalBox("organ"); | |
| ui_interface->closeBox(); | |
| } | |
| virtual void compute(int count, FAUSTFLOAT** RESTRICT inputs, FAUSTFLOAT** RESTRICT outputs) { | |
| FAUSTFLOAT* input0 = inputs[0]; | |
| FAUSTFLOAT* input1 = inputs[1]; | |
| FAUSTFLOAT* output0 = outputs[0]; | |
| #pragma clang loop vectorize(enable) interleave(enable) | |
| for (int i0 = 0; i0 < count; i0 = i0 + 1) { | |
| output0[i0] = static_cast<FAUSTFLOAT>(static_cast<float>(input0[i0]) + static_cast<float>(input1[i0])); | |
| } | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment