summaryrefslogtreecommitdiff
path: root/faust-ksoloti-object.c
blob: 85249062c882009556a0a3278530d645fb1393a3 (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="<<NAME>>" uuid="<<UUID>>" sha="000d84e43d5934e94f32e1d50318f8feede69769">
    <sDescription><<DESCRIPTION>></sDescription>
    <author><<AUTHOR>></author>
    <license><<LICENSE>></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>