summaryrefslogtreecommitdiff
path: root/faust-ksoloti-object.c
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2024-04-30 06:40:17 +0200
committerRicardo Wurmus <rekado@elephly.net>2024-04-30 06:46:47 +0200
commit491ae9ba960e65325f3676bff6dec0c3bc74170b (patch)
treecfb915ec7aa022ee4b9e896572b0d0397f220078 /faust-ksoloti-object.c
Initial commit.
Diffstat (limited to 'faust-ksoloti-object.c')
-rw-r--r--faust-ksoloti-object.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/faust-ksoloti-object.c b/faust-ksoloti-object.c
new file mode 100644
index 0000000..82e575d
--- /dev/null
+++ b/faust-ksoloti-object.c
@@ -0,0 +1,65 @@
+<objdefs>
+ <obj.normal id="moog_vcf_2b" uuid="0009f089dced01ba64f7e22ac77fd78fbec47db9" sha="000d84e43d5934e94f32e1d50318f8feede69769">
+ <sDescription>Moog VCF (moog_vcf_2b)</sDescription>
+ <author>Ricardo Wurmus (Ksoloti), Julius O. Smith III (Faust)</author>
+ <license>STK-4.3</license>
+ <helpPatch/>
+ <includes>
+ <include>math.h</include>
+ <include>axoloti.h</include>
+ </includes>
+ <inlets>
+ <frac32buffer name="in" description="filter input"/>
+ <<INLETS>>
+ </inlets>
+ <outlets>
+ <frac32buffer name="out" description="filter output"/>
+ </outlets>
+ <displays/>
+ <params>
+ <<PARAMS>>
+ </params>
+ <attribs/>
+ <code.declaration><![CDATA[
+float fmaxf (float a, float b) {
+ return a > b ? a : b;
+}
+float fminf (float a, float b) {
+ return a < b ? a : b;
+}
+float tanf(float x) {
+ return sinf(x) / cosf(x);
+}
+
+//----------------------------------------------------------------------------
+// FAUST generated signal processor
+//----------------------------------------------------------------------------
+
+<<includeIntrinsic>>
+
+<<includeclass>>
+
+mydsp mdsp;
+]]></code.declaration>
+ <code.init><![CDATA[initmydsp(&mdsp, 48000.0);]]></code.init>
+ <code.dispose><![CDATA[//deletemydsp(mdsp);]]></code.dispose>
+ <code.krate><![CDATA[// Calculate audio
+<<SLIDERS>>
+
+float inf[BUFSIZE] = {};
+float outf[BUFSIZE] = {};
+
+for (uint8_t i = 0; i < BUFSIZE; i++) {
+ inf[i] = q27_to_float(inlet_in[i]);
+}
+
+float* inp = (float*) &inf;
+float* outp = (float*) &outf;
+
+computemydsp(&mdsp, BUFSIZE, *inp, *outp);
+
+for (uint8_t i = 0; i < BUFSIZE; i++) {
+ outlet_out[i] = float_to_q27(outf[i]);
+}]]></code.krate>
+ </obj.normal>
+</objdefs>