[SCM] calf/master: + Compressor: Added knee support.
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:38:02 UTC 2013
The following commit has been merged in the master branch:
commit ee56776ccd6ac527b7e9e5783dc12fb869df5d8a
Author: Thor Harald Johansen <thj at thj.no>
Date: Fri Oct 31 03:38:23 2008 +0100
+ Compressor: Added knee support.
diff --git a/src/calf/modules_dev.h b/src/calf/modules_dev.h
index aad5b7e..b785886 100644
--- a/src/calf/modules_dev.h
+++ b/src/calf/modules_dev.h
@@ -28,7 +28,7 @@ namespace synth {
class compressor_audio_module: public null_audio_module {
public:
enum { in_count = 2, out_count = 2, support_midi = false, rt_capable = true };
- enum { param_threshold, param_ratio, param_attack, param_release, param_makeup, param_compression, param_count };
+ enum { param_threshold, param_ratio, param_attack, param_release, param_makeup, param_knee, param_compression, param_count };
static const char *port_names[in_count + out_count];
static synth::ladspa_plugin_info plugin_info;
@@ -48,6 +48,7 @@ public:
float attack_coeff = 1 / (*params[param_attack] * srate / 4000);
float release_coeff = 1 / (*params[param_release] * srate / 4000);
float makeup = *params[param_makeup];
+ bool knee = *params[param_knee] > 0.5;
if(params[param_compression] != NULL) {
*params[param_compression] = aim;
@@ -61,6 +62,14 @@ public:
target /= ratio;
target += threshold;
target /= asample;
+ } else if(asample > 0 && knee) {
+ target = asample - threshold;
+ target /= ratio;
+ target += threshold;
+ float knee1 = pow(asample / threshold, 3);
+ float knee2 = 1 - knee1;
+ target = target * knee1 + asample * knee2;
+ target /= asample;
} else {
target = 1;
}
diff --git a/src/modules.cpp b/src/modules.cpp
index f5ec068..c80441c 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -179,7 +179,8 @@ parameter_properties compressor_audio_module::param_props[] = {
{ 10, 1, 2000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "attack", "Attack" },
{ 100, 1, 2000, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_MSEC, NULL, "release", "Release" },
{ 1, 1, 12, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "makeup", "Makeup Gain" },
- { 0, 0.015625, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_CTLO_REVERSE | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "compression", "Compression" }
+ { 0, 0, 1, 0, PF_BOOL | PF_CTL_TOGGLE, NULL, "knee", "Knee" },
+ { 0, 0.03125, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_CTLO_REVERSE | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "compression", "Compression" }
};
synth::ladspa_plugin_info compressor_audio_module::plugin_info = { 0x8502, "Compressor", "Calf Compressor", "Thor Harald Johansen", synth::calf_copyright_info, "CompressorPlugin" };
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list