-
Notifications
You must be signed in to change notification settings - Fork 52
/
hard_limiter_1413.xml
61 lines (52 loc) · 1.65 KB
/
hard_limiter_1413.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
<?xml version="1.0"?>
<!DOCTYPE ladspa SYSTEM "ladspa-swh.dtd">
<?xml-stylesheet href="ladspa.css" type="text/css"?>
<ladspa>
<global>
<meta name="maker" value="Marcus Andersson"/>
<meta name="copyright" value="GPL"/>
<meta name="properties" value="HARD_RT_CAPABLE"/>
<code><![CDATA[
#include <math.h>
#include "ladspa-util.h"
]]></code>
</global>
<plugin label="hardLimiter" id="1413" class="LimiterPlugin,DistortionPlugin">
<name>Hard Limiter</name>
<p>Brick hard limiter with residue mixer.</p>
<callback event="run"><![CDATA[
unsigned long i;
for (i = 0; i < sample_count; i++)
{
float limit_g = pow(10, limit_db / 20);
float sign = input[i] < 0.0 ? -1.0 : 1.0;
float data = input[i] * sign;
float residue = data > limit_g ? data - limit_g : 0.0;
data -= residue;
buffer_write(output[i],
sign * (wet_gain * data + res_gain * residue));
}
]]></callback>
<port label="limit_db" dir="input" type="control" hint="default_0">
<name>dB limit</name>
<p></p>
<range min="-50.0" max="0.0"/>
</port>
<port label="wet_gain" dir="input" type="control" hint="default_1">
<name>Wet level</name>
<p>Output level for limited signal.</p>
<range min="0.0" max="1.0"/>
</port>
<port label="res_gain" dir="input" type="control" hint="default_0">
<name>Residue level</name>
<p>Output level for residue signal.</p>
<range min="0.0" max="1.0"/>
</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>