-
Notifications
You must be signed in to change notification settings - Fork 52
/
impulse_1885.xml
64 lines (52 loc) · 1.63 KB
/
impulse_1885.xml
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
<?xml version="1.0"?>
<!DOCTYPE ladspa SYSTEM "ladspa-swh.dtd">
<?xml-stylesheet href="ladspa.css" type="text/css"?>
<ladspa>
<global>
<meta name="maker" value="Andy Wingo <wingo at pobox dot com>"/>
<meta name="copyright" value="GPL"/>
<meta name="properties" value="HARD_RT_CAPABLE"/>
<code><![CDATA[
#include "ladspa-util.h"
#define LOG001 -6.9077552789f
]]></code>
</global>
<!-- ****** IMPULSE-FC ****** -->
<plugin label="impulse_fc" id="1885" class="UtilityPlugin">
<name>Nonbandlimited single-sample impulses (Frequency: Control)</name>
<p>Based on work by James McCartney in SuperCollider.</p>
<callback event="instantiate"><![CDATA[
sample_rate = s_rate;
phase = 0.f;
]]></callback>
<callback event="activate"><![CDATA[
phase = 0.f;
]]></callback>
<callback event="run"><![CDATA[
int i;
float phase_step = frequency / sample_rate;
for (i=0; i<sample_count; i++) {
if (phase > 1.f) {
phase -= 1.f;
buffer_write(out[i], 1.f);
} else {
buffer_write(out[i], 0.f);
}
phase += phase_step;
}
plugin_data->phase = phase;
]]></callback>
<port label="frequency" dir="input" type="control" hint="default_1">
<name>Frequency (Hz)</name>
<range min="0"/>
<p>
Frequency for the impulses.
</p>
</port>
<port label="out" dir="output" type="audio">
<name>Output</name>
</port>
<instance-data label="sample_rate" type="LADSPA_Data" />
<instance-data label="phase" type="float" />
</plugin>
</ladspa>