加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
satan_maximiser_1408.xml 2.92 KB
一键复制 编辑 原始数据 按行查看 历史
swh 提交于 2007-02-27 11:45 . Initial import
<?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>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化