[SCM] calf/master: Frequency display for multiband limiter

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


The following commit has been merged in the master branch:
commit 6783ec9685307c9fa80c43ce24d3b864cc0210ae
Author: Markus Schmidt <schmidt at boomshop.net>
Date:   Sun Nov 20 07:21:31 2011 +0100

    Frequency display for multiband limiter

diff --git a/src/calf/modules_limit.h b/src/calf/modules_limit.h
index 89cdb5f..346b89e 100644
--- a/src/calf/modules_limit.h
+++ b/src/calf/modules_limit.h
@@ -51,6 +51,7 @@ public:
     void params_changed();
     uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
     void set_sample_rate(uint32_t sr);
+    bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context) const;
     bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const;
 };
 
diff --git a/src/metadata.cpp b/src/metadata.cpp
index b8852c6..5d80cb9 100644
--- a/src/metadata.cpp
+++ b/src/metadata.cpp
@@ -311,7 +311,7 @@ CALF_PORT_PROPS(multibandcompressor) = {
     { 0,           0,           1,     0,  PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_outL", "0dB-OutL" },
     { 0,           0,           1,     0,  PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_outR", "0dB-OutR" },
     
-    { 100,         10,          20000, 0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq0", "Split 1/2" },
+    { 120,         10,          20000, 0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq0", "Split 1/2" },
     { 1000,        10,          20000, 0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq1", "Split 2/3" },
     { 6000,        10,          20000, 0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq2", "Split 3/4" },
     
@@ -506,7 +506,7 @@ CALF_PORT_PROPS(multibandlimiter) = {
     { 0,           0,           1,     0,  PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_outL", "0dB-OutL" },
     { 0,           0,           1,     0,  PF_FLOAT | PF_CTL_LED | PF_PROP_OUTPUT | PF_PROP_OPTIONAL, NULL, "clip_outR", "0dB-OutR" },
     
-    { 100,         10,          20000, 0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq0", "Split 1/2" },
+    { 120,         10,          20000, 0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq0", "Split 1/2" },
     { 1000,        10,          20000, 0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq1", "Split 2/3" },
     { 6000,        10,          20000, 0,  PF_FLOAT | PF_SCALE_LOG | PF_CTL_KNOB | PF_UNIT_HZ | PF_PROP_GRAPH, NULL, "freq2", "Split 3/4" },
     
diff --git a/src/modules_limit.cpp b/src/modules_limit.cpp
index 4a0e381..9a1fde3 100644
--- a/src/modules_limit.cpp
+++ b/src/modules_limit.cpp
@@ -286,22 +286,43 @@ uint32_t multibandlimiter_audio_module::process(uint32_t offset, uint32_t numsam
     return outputs_mask;
 }
 
-bool  multibandlimiter_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
+bool multibandlimiter_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_iface *context) const
 {
-    bool tmp;
-    printf("%d\n", index);
-    vertical = (subindex & 1) != 0;
-    bool result = get_freq_gridline(subindex >> 1, pos, tmp, legend, context, false);
-    if (result && vertical) {
-        if ((subindex & 4) && !legend.empty()) {
-            legend = "";
+    if (!is_active or subindex > 3)
+        return false;
+    for (int i = 0; i < points; i++)
+    {
+        float ret = 1.f;
+        double freq = 20.0 * pow (20000.0 / 20.0, i * 1.0 / points);
+        switch(subindex) {
+            case 0:
+                ret *= lpL0.freq_gain(freq, (float)srate);
+                break;
+            case 1:
+                ret *= hpL0.freq_gain(freq, (float)srate);
+                ret *= lpL1.freq_gain(freq, (float)srate);
+                break;
+            case 2:
+                ret *= hpL1.freq_gain(freq, (float)srate);
+                ret *= lpL2.freq_gain(freq, (float)srate);
+                break;
+            case 3:
+                ret *= hpL2.freq_gain(freq, (float)srate);
+                break;
         }
-        else {
-            size_t pos = legend.find(" dB");
-            if (pos != std::string::npos)
-                legend.erase(pos);
-        }
-        pos = 0.5 + 0.5 * pos;
+        data[i] = dB_grid(ret, 32, 0);
     }
-    return result;
+    context->set_line_width(1.5);
+    return true;
 }
+
+bool multibandlimiter_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
+{
+    if (!is_active) {
+        return false;
+    } else {
+        vertical = (subindex & 1) != 0;
+        return get_freq_gridline(subindex, pos, vertical, legend, context, true, 36, 0);
+    }
+}
+

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list