On 06/04, Till Bovermann wrote: > > I discovered the `ffunction` primitive that allows to integrate foreign > functions > into the language, however, AFAICS (and according to sletz on slack, and from > what > I got from the documentation at [3]), they need to be stateless. > > the aforementioned 1-bit delay, though, requires a state (of one additional > integer).
Well, if your target is C/C++ you can try fpp, it allows to embed the C/C++ code into .dsp code. See https://sourceforge.net/p/faudiostream/mailman/message/36437475/ Example: mymem = FPP(x) { decl: float $z; init: $z = 0; exec: float ret = $z; $z = $x; ret; }; this (poorly) re-implements the "mem" primitive. Now, process = mymem, mymem; compiles to class mydsp : public dsp { private: float z__01; float z__02; int fSampleRate; public: ... virtual void instanceConstants(int sample_rate) { fSampleRate = sample_rate; z__01 = 0; z__02 = 0; } ... virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) { FAUSTFLOAT* input0 = inputs[0]; FAUSTFLOAT* input1 = inputs[1]; FAUSTFLOAT* output0 = outputs[0]; FAUSTFLOAT* output1 = outputs[1]; for (int i = 0; (i < count); i = (i + 1)) { output0[i] = FAUSTFLOAT(float(({ float ret = z__01; z__01 = input0[i]; ret; }))); output1[i] = FAUSTFLOAT(float(({ float ret = z__02; z__02 = input1[i]; ret; }))); } } }; Oleg. _______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users