[SCM] calf/master: Use symmetric dB range for EQ plugins.

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


The following commit has been merged in the master branch:
commit cb3e7e001da3e0f43b3da8eed3f9660698f87ca2
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Sat Nov 6 23:44:11 2010 +0000

    Use symmetric dB range for EQ plugins.

diff --git a/src/calf/giface.h b/src/calf/giface.h
index 4bb5df9..746200b 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -634,22 +634,22 @@ public:
     
 extern const char *calf_copyright_info;
 
-bool get_freq_gridline(int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context, bool use_frequencies = true);
+bool get_freq_gridline(int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context, bool use_frequencies = true, float res = 256, float ofs = 0.4);
     
 /// convert amplitude value to normalized grid-ish value (0dB = 0.5, 30dB = 1.0, -30 dB = 0.0, -60dB = -0.5, -90dB = -1.0)
-static inline float dB_grid(float amp)
+static inline float dB_grid(float amp, float res = 256, float ofs = 0.4)
 {
-    return log(amp) * (1.0 / log(256.0)) + 0.4;
+    return log(amp) * (1.0 / log(res)) + ofs;
 }
 
 template<class Fx>
-static bool get_graph(Fx &fx, int subindex, float *data, int points)
+static bool get_graph(Fx &fx, int subindex, float *data, int points, float res = 256, float ofs = 0.4)
 {
     for (int i = 0; i < points; i++)
     {
         typedef std::complex<double> cfloat;
         double freq = 20.0 * pow (20000.0 / 20.0, i * 1.0 / points);
-        data[i] = dB_grid(fx.freq_gain(subindex, freq, fx.srate));
+        data[i] = dB_grid(fx.freq_gain(subindex, freq, fx.srate), res, ofs);
     }
     return true;
 }
diff --git a/src/giface.cpp b/src/giface.cpp
index 977ce06..baa962e 100644
--- a/src/giface.cpp
+++ b/src/giface.cpp
@@ -212,7 +212,7 @@ const char *calf_plugins::load_gui_xml(const std::string &plugin_id)
     }
 }
 
-bool calf_plugins::get_freq_gridline(int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context, bool use_frequencies)
+bool calf_plugins::get_freq_gridline(int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context, bool use_frequencies, float res, float ofs)
 {
     if (subindex < 0 )
 	return false;
@@ -245,7 +245,7 @@ bool calf_plugins::get_freq_gridline(int subindex, float &pos, bool &vertical, s
     if (subindex >= 32)
         return false;
     float gain = 16.0 / (1 << subindex);
-    pos = dB_grid(gain);
+    pos = dB_grid(gain, res, ofs);
     if (pos < -1)
         return false;
     if (subindex != 4)
diff --git a/src/modules_eq.cpp b/src/modules_eq.cpp
index 04cd0ae..35a1a80 100644
--- a/src/modules_eq.cpp
+++ b/src/modules_eq.cpp
@@ -248,7 +248,7 @@ bool equalizerNband_audio_module<BaseClass, has_lphp>::get_graph(int index, int
         return false;
     if (index == AM::param_p1_freq && !subindex) {
         context->set_line_width(1.5);
-        return ::get_graph(*this, subindex, data, points);
+        return ::get_graph(*this, subindex, data, points, 32, 0);
     }
     return false;
 }
@@ -259,7 +259,7 @@ bool equalizerNband_audio_module<BaseClass, has_lphp>::get_gridline(int index, i
     if (!is_active) {
         return false;
     } else {
-        return get_freq_gridline(subindex, pos, vertical, legend, context);
+        return get_freq_gridline(subindex, pos, vertical, legend, context, true, 32, 0);
     }
 }
 

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list