[SCM] calf/master: + Compressor: Fixed spazzing caused by thread issues.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:38:37 UTC 2013


The following commit has been merged in the master branch:
commit 707db594944364a7e6714e24372d680d071eb777
Author: Thor Harald Johansen <thj at thj.no>
Date:   Wed Nov 26 00:42:40 2008 +0100

    + Compressor: Fixed spazzing caused by thread issues.

diff --git a/src/calf/metadata.h b/src/calf/metadata.h
index d8f4335..7572e29 100644
--- a/src/calf/metadata.h
+++ b/src/calf/metadata.h
@@ -97,7 +97,7 @@ struct monosynth_metadata: public plugin_metadata<monosynth_metadata>
 struct compressor_metadata: public plugin_metadata<compressor_metadata>
 {
     enum { in_count = 2, out_count = 2, support_midi = false, require_midi = false, rt_capable = true };
-    enum { param_threshold, param_ratio, param_attack, param_release, param_makeup, param_knee, param_detection, param_stereo_link, param_aweighting, param_compression, param_peak, param_clip, param_bypass, param_count };
+    enum { param_threshold, param_ratio, param_attack, param_release, param_makeup, param_knee, param_detection, param_stereo_link, param_aweighting, param_compression, param_peak, param_clip, param_bypass, param_logarithmic, param_count };
     PLUGIN_NAME_ID_LABEL("compressor", "compressor", "Compressor")
 };
 
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 46c418c..b3ddb43 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -686,11 +686,10 @@ public:
 
 class compressor_audio_module: public audio_module<compressor_metadata>, public line_graph_iface {
 private:
-    float linslope, clip, peak, detected, kneeSqrt, kneeStart, kneeStop, threshold, ratio, knee, makeup, logarithmic;
-    bool aweighting;
+    float linslope, clip, peak, detected, kneeSqrt, kneeStart, kneeStop, threshold, ratio, knee, makeup;
+    bool aweighting, logarithmic;
     aweighter awL, awR;
 public:
-
     float *ins[in_count];
     float *outs[out_count];
     float *params[param_count];
@@ -704,7 +703,7 @@ public:
         bool rms = *params[param_detection] == 0;
         bool average = *params[param_stereo_link] == 0;
         aweighting = *params[param_aweighting] > 0.5f;
-        threshold = *params[param_threshold];
+        float linThreshold = *params[param_threshold];
         ratio = *params[param_ratio];
         float attack = *params[param_attack];
         float attack_coeff = std::min(1.f, 1.f / (attack * srate / 4000.f));
@@ -712,17 +711,20 @@ public:
         float release_coeff = std::min(1.f, 1.f / (release * srate / 4000.f));
         makeup = *params[param_makeup];
         knee = *params[param_knee];
+        logarithmic = *params[param_logarithmic] > 0.5f;
 
-        logarithmic = true;
-
-        kneeSqrt = sqrt(knee);
-        kneeStart = threshold / kneeSqrt;
-        kneeStop = threshold * kneeSqrt;
+        float linKneeSqrt = sqrt(knee);
+        float linKneeStart = linThreshold / linKneeSqrt;
+        float linKneeStop = linThreshold * linKneeSqrt;
         
         if(logarithmic) {
-            threshold = threshold > 0.f ? log(threshold) / log(2) : 0.f;
-            kneeStart = kneeStart > 0.f ? log(kneeStart) / log(2) : 0.f;
-            kneeStop = kneeStop > 0.f ? log(kneeStop) / log(2) : 0.f;
+            threshold = linThreshold > 0.f ? log(linThreshold) / log(2) : 0.f;
+            kneeStart = linKneeStart > 0.f ? log(linKneeStart) / log(2) : 0.f;
+            kneeStop = linKneeStop > 0.f ? log(linKneeStop) / log(2) : 0.f;
+        } else {
+            threshold = linThreshold;
+            kneeStart = linKneeStart;
+            kneeStop = linKneeStop;
         }
 
         numsamples += offset;
diff --git a/src/modules.cpp b/src/modules.cpp
index 168f229..96f2b19 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -190,6 +190,7 @@ CALF_PORT_PROPS(compressor) = {
     { 0,      0,  1,    0, PF_FLOAT | PF_SCALE_GAIN | PF_CTL_METER | PF_CTLO_LABEL | PF_UNIT_DB | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "peak", "Peak" },
     { 0,      0,  1,    0, PF_BOOL | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip", "Clip" },
     { 0,      0,  1,    0, PF_BOOL | PF_CTL_TOGGLE, NULL, "bypass", "Bypass" },
+    { 1,      0,  1,    0, PF_BOOL | PF_CTL_TOGGLE, NULL, "logarithmic", "Logarithmic" }
 };
 
 CALF_PLUGIN_INFO(compressor) = { 0x8502, "Compressor", "Calf Compressor", "Thor Harald Johansen", calf_plugins::calf_copyright_info, "CompressorPlugin" };

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list