File: satan_maximiser_1408.xml

package info (click to toggle)
swh-plugins 0.4.17-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, stretch
  • size: 3,264 kB
  • ctags: 1,066
  • sloc: ansic: 23,551; xml: 12,633; perl: 1,114; sh: 964; makefile: 221
file content (99 lines) | stat: -rw-r--r-- 2,992 bytes parent folder | download | duplicates (8)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?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 &lt;steve@plugin.org.uk&gt;"/>
    <meta name="copyright" value="GPL"/>
    <meta name="properties" value="HARD_RT_CAPABLE"/>
    <code><![CDATA[
      #include <math.h>
      #include "ladspa-util.h"

      #define BUFFER_SIZE 16
      #define BUFFER_MASK 15
    ]]></code>
  </global>

  <plugin label="satanMaximiser" id="1408" class="DynamicsPlugin,DistortionPlugin">
    <name>Barry's Satan Maximiser</name>
    <p>Formerly Stupid Compressor. Thanks to Matt Yee-King for the name.</p>
    <p>Compresses signals with a stupidly short attack and decay, infinite
ratio and hard knee. Not really as a compressor, but good harsh (non-musical)
distortion.</p>

    <callback event="instantiate"><![CDATA[
      env = 0.0f;
      buffer = malloc(sizeof(LADSPA_Data) * BUFFER_SIZE);
      buffer_pos = 0;
    ]]></callback>

    <callback event="activate"><![CDATA[
      env = 0.0f;
      memset(buffer, 0, sizeof(LADSPA_Data) * BUFFER_SIZE);
      buffer_pos = 0;
    ]]></callback>

    <callback event="cleanup"><![CDATA[
      free(plugin_data->buffer);
    ]]></callback>

    <callback event="run"><![CDATA[
      unsigned long pos;
      int delay;
      float env_tr, env_sc, knee;
      float env_time = env_time_p;

      if (env_time < 2.0f) {
	env_time = 2.0f;
      }
      knee = DB_CO(knee_point);
      delay = f_round(env_time * 0.5f);
      env_tr = 1.0f / env_time;

      for (pos = 0; pos < sample_count; pos++) {
	if (fabs(input[pos]) > env) {
	  env = fabs(input[pos]);
	} else {
	  env = fabs(input[pos]) * env_tr + env * (1.0f - env_tr);
	}
	if (env <= knee) {
	  env_sc = 1.0f / knee;
	} else {
	  env_sc = 1.0f / env;
	}
	buffer[buffer_pos] = input[pos];
	buffer_write(output[pos], buffer[(buffer_pos - delay) & BUFFER_MASK] * env_sc);
	buffer_pos = (buffer_pos + 1) & BUFFER_MASK;
      }

      plugin_data->env = env;
      plugin_data->buffer_pos = buffer_pos;
    ]]></callback>

    <port label="env_time_p" dir="input" type="control" hint="default_maximum">
      <name>Decay time (samples)</name>
      <p>Controls the envelope decay time.</p>
      <range min="2" max="30"/>
    </port>

    <port label="knee_point" dir="input" type="control" hint="default_0">
      <name>Knee point (dB)</name>
      <p>Controls the knee roll-off point, ie. the point above which the compression kicks in. 0 will have no effect, -90 will remove virtually all dynamic range.</p>
      <range min="-90" max="0"/>
    </port>

    <port label="input" dir="input" type="audio">
      <name>Input</name>
    </port>

    <port label="output" dir="output" type="audio">
      <name>Output</name>
    </port>

    <instance-data label="env" type="float" />
    <instance-data label="buffer" type="LADSPA_Data *" />
    <instance-data label="buffer_pos" type="unsigned int" />
  </plugin>
</ladspa>