[SCM] calf/master: + Compressor add graph caching support

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:39:09 UTC 2013


The following commit has been merged in the master branch:
commit 35fe1b8286ada3c099b189a088263768e219008f
Author: Torben Hohn <torbenh at gmx.de>
Date:   Sun Jan 25 11:17:39 2009 +0100

    + Compressor add graph caching support

diff --git a/src/calf/modules.h b/src/calf/modules.h
index eaa347b..1cbcfd2 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -800,6 +800,8 @@ public:
 class compressor_audio_module: public audio_module<compressor_metadata>, public line_graph_iface {
 private:
     float linSlope, peak, detected, kneeSqrt, kneeStart, linKneeStart, kneeStop, threshold, ratio, knee, makeup, compressedKneeStop, adjKneeStart;
+    float old_threshold, old_ratio, old_knee, old_makeup;
+    int last_generation;
     uint32_t clip;
     aweighter awL, awR;
 public:
@@ -812,7 +814,7 @@ public:
     void activate();
     void deactivate();
     uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
-
+    
     inline float output_level(float slope) {
         return slope * output_gain(slope, false) * makeup;
     }
@@ -847,6 +849,26 @@ public:
     virtual bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context);
     virtual bool get_dot(int index, int subindex, float &x, float &y, int &size, cairo_iface *context);
     virtual bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context);
+
+    virtual int  get_changed_offsets(int generation, int &subindex_graph, int &subindex_dot, int &subindex_gridline)
+    {
+	subindex_graph = 0;
+	subindex_dot = 0;
+	subindex_gridline = generation ? INT_MAX : 0;
+
+        if (fabs(threshold-old_threshold) + fabs(ratio - old_ratio) + fabs(knee - old_knee) + fabs( makeup - old_makeup) > 0.1f)
+        {
+	    old_threshold = threshold;
+	    old_ratio = ratio;
+	    old_knee = knee;
+	    old_makeup = makeup;
+            last_generation++;
+        }
+
+        if (generation == last_generation)
+            subindex_graph = 2;
+        return last_generation;
+    }
 };
 
 /// Filterclavier --- MIDI controlled filter by Hans Baier
diff --git a/src/modules_dsp.cpp b/src/modules_dsp.cpp
index a7e5387..c8706b7 100644
--- a/src/modules_dsp.cpp
+++ b/src/modules_dsp.cpp
@@ -398,6 +398,7 @@ compressor_audio_module::compressor_audio_module()
 {
     is_active = false;
     srate = 0;
+    last_generation = 0;
 }
 
 void compressor_audio_module::activate()

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list