[SCM] calf/master: + Multichorus, Filter, Flanger: graph improvements
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:38:29 UTC 2013
The following commit has been merged in the master branch:
commit 083da237b1d28851e7e9f7f7da95a1cae77b4c83
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Sat Nov 15 21:42:05 2008 +0000
+ Multichorus, Filter, Flanger: graph improvements
diff --git a/gui/gui-multichorus.xml b/gui/gui-multichorus.xml
index db71c1a..74ce291 100644
--- a/gui/gui-multichorus.xml
+++ b/gui/gui-multichorus.xml
@@ -43,8 +43,17 @@
</hbox>
</frame>
<if cond="directlink">
- <vbox expand-x="1" fill-x="1" attach-x="3" attach-y="0" attach-h="7">
- <line-graph refresh="1" width="160" height="160" param="min_delay"/>
- </vbox>
+ <hbox>
+ <frame label="Freq. response">
+ <vbox expand-x="1" fill-x="1" attach-x="3" attach-y="0" attach-h="7">
+ <line-graph refresh="1" width="160" height="160" param="min_delay"/>
+ </vbox>
+ </frame>
+ <frame label="LFO positions">
+ <vbox expand-x="1" fill-x="1" attach-x="3" attach-y="0" attach-h="7">
+ <line-graph refresh="1" width="160" height="160" param="mod_rate"/>
+ </vbox>
+ </frame>
+ </hbox>
</if>
</vbox>
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 8b16d9c..d71eca3 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -129,6 +129,7 @@ public:
return outputs_mask; // XXXKF allow some delay after input going blank
}
bool get_graph(int index, int subindex, float *data, int points, cairo_t *context);
+ bool get_gridline(int index, int subindex, float &pos, bool &vertical, cairo_t *context);
float freq_gain(int subindex, float freq, float srate);
};
@@ -365,6 +366,7 @@ public:
}
bool get_graph(int index, int subindex, float *data, int points, cairo_t *context);
float freq_gain(int subindex, float freq, float srate);
+ bool get_gridline(int index, int subindex, float &pos, bool &vertical, cairo_t *context);
};
class vintage_delay_audio_module: public audio_module<vintage_delay_metadata>
@@ -686,6 +688,8 @@ public:
void set_sample_rate(uint32_t sr);
bool get_graph(int index, int subindex, float *data, int points, cairo_t *context);
float freq_gain(int subindex, float freq, float srate);
+ bool get_dot(int index, int subindex, float &x, float &y, int &size, cairo_t *context);
+ bool get_gridline(int index, int subindex, float &pos, bool &vertical, cairo_t *context);
};
extern std::string get_builtin_modules_rdf();
diff --git a/src/calf/modules_dev.h b/src/calf/modules_dev.h
index 6e90ec3..debc16f 100644
--- a/src/calf/modules_dev.h
+++ b/src/calf/modules_dev.h
@@ -191,7 +191,7 @@ public:
virtual bool get_dot(int index, int subindex, float &x, float &y, int &size, cairo_t *context) {
if (!subindex)
{
- x = 1 + 2 * log(detected) / log(65536);
+ x = 1 + log(detected) / log(65536);
y = 1 + 2 * log(output_level(detected)) / log(65536);
return true;
}
diff --git a/src/modules_dsp.cpp b/src/modules_dsp.cpp
index d8e0112..6c623c7 100644
--- a/src/modules_dsp.cpp
+++ b/src/modules_dsp.cpp
@@ -26,10 +26,19 @@
#endif
#include <calf/giface.h>
#include <calf/modules.h>
+#include <cairo/cairo.h>
using namespace dsp;
using namespace calf_plugins;
+static void set_channel_color(cairo_t *context, int channel)
+{
+ if (channel & 1)
+ cairo_set_source_rgb(context, 0.75, 1, 0);
+ else
+ cairo_set_source_rgb(context, 0, 1, 0.75);
+}
+
void flanger_audio_module::activate() {
left.reset();
right.reset();
@@ -54,7 +63,10 @@ bool flanger_audio_module::get_graph(int index, int subindex, float *data, int p
if (!is_active)
return false;
if (index == par_delay && subindex < 2)
+ {
+ set_channel_color(context, subindex);
return calf_plugins::get_graph(*this, subindex, data, points);
+ }
return false;
}
@@ -63,6 +75,17 @@ float flanger_audio_module::freq_gain(int subindex, float freq, float srate)
return (subindex ? right : left).freq_gain(freq, srate);
}
+bool flanger_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, cairo_t *context)
+{
+ if (index == par_delay && !subindex)
+ {
+ pos = 0.5;
+ vertical = false;
+ return true;
+ }
+ return false;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////
void phaser_audio_module::set_sample_rate(uint32_t sr)
@@ -146,6 +169,17 @@ float filter_audio_module::freq_gain(int subindex, float freq, float srate)
return level;
}
+bool filter_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, cairo_t *context)
+{
+ if (index == par_cutoff && !subindex)
+ {
+ pos = 0.5;
+ vertical = false;
+ return true;
+ }
+ return false;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////
rotary_speaker_audio_module::rotary_speaker_audio_module()
@@ -223,7 +257,44 @@ bool multichorus_audio_module::get_graph(int index, int subindex, float *data, i
if (!is_active)
return false;
if (index == par_delay && subindex < 2)
+ {
+ set_channel_color(context, subindex);
return calf_plugins::get_graph(*this, subindex, data, points);
+ }
+ if (index == par_rate && !subindex) {
+ for (int i = 0; i < points; i++)
+ data[i] = 0.95 * sin(i * 2 * M_PI / points);
+ return true;
+ }
+ return false;
+}
+
+bool multichorus_audio_module::get_dot(int index, int subindex, float &x, float &y, int &size, cairo_t *context)
+{
+ if (index != par_rate || subindex >= 2 * (int)*params[par_voices])
+ return false;
+
+ set_channel_color(context, subindex);
+ sine_multi_lfo<float, 8> &lfo = (subindex & 1 ? right : left).lfo;
+ x = (double)(lfo.phase + lfo.vphase * (subindex >> 1)) / 4096.0;
+ y = 0.95 * sin(x * 2 * M_PI);
+ return true;
+}
+
+bool multichorus_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, cairo_t *context)
+{
+ if (index == par_rate && !subindex)
+ {
+ pos = 0;
+ vertical = false;
+ return true;
+ }
+ if (index == par_delay && !subindex)
+ {
+ pos = 0.5;
+ vertical = false;
+ return true;
+ }
return false;
}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list