[SCM] calf/master: + Compressor: Added makeup gain and attack/release.
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:37:59 UTC 2013
The following commit has been merged in the master branch:
commit 3fdcbc32294896e7f342febd130f3ff012d81b42
Author: Thor Harald Johansen <thj at thj.no>
Date: Thu Oct 30 23:00:38 2008 +0100
+ Compressor: Added makeup gain and attack/release.
diff --git a/src/calf/modules_dev.h b/src/calf/modules_dev.h
index 84ed443..40a0154 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_compression, param_count };
+ enum { param_threshold, param_ratio, param_attack, param_release, param_makeup, param_compression, param_count };
static const char *port_names[in_count + out_count];
static synth::ladspa_plugin_info plugin_info;
@@ -45,6 +45,9 @@ public:
numsamples += offset;
float threshold = *params[param_threshold];
float ratio = *params[param_ratio];
+ float attack_coeff = 1 / (*params[param_attack] * srate / 1000);
+ float release_coeff = 1 / (*params[param_release] * srate / 1000);
+ float makeup = *params[param_makeup];
*params[param_compression] = aim;
@@ -60,11 +63,10 @@ public:
target = 1;
}
- outs[channel][offset] = ins[channel][offset] * aim;
+ outs[channel][offset] = ins[channel][offset] * aim * makeup;
}
- aim += (target - aim) * 0.0008;
-
+ aim += (target - aim) * (aim > target ? attack_coeff : release_coeff);
++offset;
}
diff --git a/src/modules.cpp b/src/modules.cpp
index f00f7aa..3602e4c 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -176,6 +176,9 @@ synth::ladspa_plugin_info multichorus_audio_module::plugin_info = { 0x8501, "Mul
parameter_properties compressor_audio_module::param_props[] = {
{ 1, 0, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_KNOB | PF_UNIT_DB, NULL, "threshold", "Threshold" },
{ 1, 1, 100, 0, PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_COEF, NULL, "ratio", "Ratio" },
+ { 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, 1, 0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_FADER | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "compression", "Compression" }
};
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list