From f8d544d59a978bb7e329f6417383c2038816a5a1 Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Thu, 22 Jan 2009 01:34:48 +0000 Subject: [PATCH] + Compressor: do not display frequency grid lines/legend in the graph --- src/modules_dsp.cpp | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/modules_dsp.cpp b/src/modules_dsp.cpp index eec0056..2ba618b 100644 --- a/src/modules_dsp.cpp +++ b/src/modules_dsp.cpp @@ -64,31 +64,34 @@ static void set_channel_color(cairo_iface *context, int channel) context->set_line_width(1.5); } -static bool get_freq_gridline(int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) +static bool get_freq_gridline(int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context, bool use_frequencies = true) { - if (subindex < 28) + if (use_frequencies) { - vertical = true; - if (subindex == 9) legend = "100 Hz"; - if (subindex == 18) legend = "1 kHz"; - if (subindex == 27) legend = "10 kHz"; - float freq = 100; - if (subindex < 9) - freq = 10 * (subindex + 1); - else if (subindex < 18) - freq = 100 * (subindex - 9 + 1); - else if (subindex < 27) - freq = 1000 * (subindex - 18 + 1); - else - freq = 10000 * (subindex - 27 + 1); - pos = log(freq / 20.0) / log(1000); - if (!legend.empty()) - context->set_source_rgba(0.25, 0.25, 0.25, 0.75); - else - context->set_source_rgba(0.25, 0.25, 0.25, 0.5); - return true; + if (subindex < 28) + { + vertical = true; + if (subindex == 9) legend = "100 Hz"; + if (subindex == 18) legend = "1 kHz"; + if (subindex == 27) legend = "10 kHz"; + float freq = 100; + if (subindex < 9) + freq = 10 * (subindex + 1); + else if (subindex < 18) + freq = 100 * (subindex - 9 + 1); + else if (subindex < 27) + freq = 1000 * (subindex - 18 + 1); + else + freq = 10000 * (subindex - 27 + 1); + pos = log(freq / 20.0) / log(1000); + if (!legend.empty()) + context->set_source_rgba(0.25, 0.25, 0.25, 0.75); + else + context->set_source_rgba(0.25, 0.25, 0.25, 0.5); + return true; + } + subindex -= 28; } - subindex -= 28; float gain = 16.0 / (1 << subindex); pos = dB_grid(gain); if (pos < -1) @@ -437,7 +440,7 @@ bool compressor_audio_module::get_gridline(int index, int subindex, float &pos, { bool tmp; vertical = (subindex & 1) != 0; - bool result = get_freq_gridline(subindex >> 1, pos, tmp, legend, context); + bool result = get_freq_gridline(subindex >> 1, pos, tmp, legend, context, false); if (result && vertical) { if ((subindex & 4) && !legend.empty()) { legend = ""; -- 2.11.4.GIT