summaryrefslogtreecommitdiff
path: root/faust-ksoloti-object.c
blob: 97128fef4018370939a6ae311d29b12eb1954579 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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>