-
Notifications
You must be signed in to change notification settings - Fork 52
/
diode_1185.xml
56 lines (50 loc) · 1.78 KB
/
diode_1185.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
<?xml version="1.0" ?>
<!DOCTYPE ladspa SYSTEM "ladspa-swh.dtd">
<?xml-stylesheet href="ladspa.css" type="text/css" ?>
<ladspa>
<global>
<meta name="maker" value="Steve Harris <[email protected]>"/>
<meta name="copyright" value="GPL"/>
<meta name="properties" value="HARD_RT_CAPABLE"/>
</global>
<plugin label="diode" id="1185" class="DistortionPlugin">
<name>Diode Processor</name>
<p>Mangles the signal as if it had been passed through a diode rectifier network.</p>
<p>You should probably follow this with a DC offset remover, unless you want the offset.</p>
<callback event="run"><![CDATA[
unsigned long pos;
if (mode >= 0.0f && mode < 1.0f) {
for (pos = 0; pos < sample_count; pos++) {
buffer_write(output[pos], ((1.0f-mode) * input[pos]) +
(mode * (input[pos] > 0.0f ? input[pos] : 0.0f)));
}
} else if (mode >= 1.0f && mode < 2.0f) {
float fac = mode - 1.0f;
for (pos = 0; pos < sample_count; pos++) {
buffer_write(output[pos], ((1.0f-fac) * (input[pos] > 0 ?
input[pos] : 0.0)) + (fac * fabs(input[pos])));
}
} else if (mode >= 2) {
float fac = mode < 3 ? mode - 2 : 1.0;
for (pos = 0; pos < sample_count; pos++) {
buffer_write(output[pos], (1.0-fac) * fabs(input[pos]));
}
} else {
for (pos = 0; pos < sample_count; pos++) {
buffer_write(output[pos], input[pos]);
}
}
]]></callback>
<port label="mode" dir="input" type="control" hint="default_0">
<name>Mode (0 for none, 1 for half wave, 2 for full wave)</name>
<p>The mode parameter is continuously variable from thru to half-wave rectification to full-wave to silence.</p>
<range min="0" max="3"/>
</port>
<port label="input" dir="input" type="audio">
<name>Input</name>
</port>
<port label="output" dir="output" type="audio">
<name>Output</name>
</port>
</plugin>
</ladspa>