From a9a91053d97642d14f4959c61b0e0c68a8383563 Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Sat, 6 Nov 2010 23:44:11 +0000 Subject: [PATCH] Use symmetric dB range for EQ plugins. (cherry picked from commit cb3e7e001da3e0f43b3da8eed3f9660698f87ca2) --- plugins/ladspa_effect/calf/src/calf/giface.h | 10 +++++----- plugins/ladspa_effect/calf/src/modules_eq.cpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/ladspa_effect/calf/src/calf/giface.h b/plugins/ladspa_effect/calf/src/calf/giface.h index 4bb5df90e..746200bd5 100644 --- a/plugins/ladspa_effect/calf/src/calf/giface.h +++ b/plugins/ladspa_effect/calf/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 -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 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/plugins/ladspa_effect/calf/src/modules_eq.cpp b/plugins/ladspa_effect/calf/src/modules_eq.cpp index 04cd0ae2d..35a1a80d9 100644 --- a/plugins/ladspa_effect/calf/src/modules_eq.cpp +++ b/plugins/ladspa_effect/calf/src/modules_eq.cpp @@ -248,7 +248,7 @@ bool equalizerNband_audio_module::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::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); } }