[SCM] calf/master: line-graph renewable from plugin
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:40:59 UTC 2013
The following commit has been merged in the master branch:
commit a9983d601e301b96bed632f3b59ed85c84aeeecf
Author: Markus Schmidt <schmidt at boomshop.net>
Date: Tue Mar 6 08:10:41 2012 +0100
line-graph renewable from plugin
diff --git a/src/calf/giface.h b/src/calf/giface.h
index 1acdefc..460b77a 100644
--- a/src/calf/giface.h
+++ b/src/calf/giface.h
@@ -196,6 +196,10 @@ struct line_graph_iface
/// @retval Current generation (to pass when calling the function next time); if different than passed generation value, call the function again to retrieve which graph offsets should be put into cache
virtual int get_changed_offsets(int index, int generation, int &subindex_graph, int &subindex_dot, int &subindex_gridline) const { subindex_graph = subindex_dot = subindex_gridline = 0; return 0; }
+ /// Return if a graph should redraw completely
+ /// @param index Parameter/graph number (usually tied to particular plugin control port)
+ virtual bool get_clear_all(int index) const { return false; }
+
/// Standard destructor to make compiler happy
virtual ~line_graph_iface() {}
};
diff --git a/src/calf/modules.h b/src/calf/modules.h
index 91b8035..21efd51 100644
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@ -321,8 +321,9 @@ public:
uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
bool get_phase_graph(float ** _buffer, int * _length, int * _mode, bool * _use_fade, float * _fade, int * _accuracy, bool * _display) const;
bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context, int *mode) const;
-
-
+ bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const;
+ bool get_clear_all(int index) const;
+ mutable int _mode_old;
protected:
static const int max_phase_buffer_size = 8192;
int phase_buffer_size;
diff --git a/src/custom_ctl.cpp b/src/custom_ctl.cpp
index 03a4d66..11b0fe0 100644
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@ -116,7 +116,7 @@ calf_line_graph_draw_graph( cairo_t *c, float *data, int sx, int sy, int mode )
case 3:
// this one is drawing bars centered on the y axis
if (i and ((data[i] < INFINITY) or i == sx - 1)) {
- cairo_rectangle(c, ox + _last, oy + sy / 2, i - _last, data[i] * (sx / 2));
+ cairo_rectangle(c, ox + _last, oy + sy / 2, i - _last, -1 * data[i] * (sx / 2));
_last = i;
} else {
continue;
@@ -196,8 +196,8 @@ calf_line_graph_expose (GtkWidget *widget, GdkEventExpose *event)
int cache_graph_index, cache_dot_index, cache_grid_index;
int gen_index = lg->source->get_changed_offsets( lg->source_id, lg->last_generation, cache_graph_index, cache_dot_index, cache_grid_index );
-
- if( cache_dirty || (gen_index != lg->last_generation) ) {
+
+ if( cache_dirty || gen_index != lg->last_generation || lg->source->get_clear_all(lg->source_id)) {
cairo_t *cache_cr = cairo_create( lg->cache_surface );
diff --git a/src/modules.cpp b/src/modules.cpp
index 5ae81ac..00f500e 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -859,6 +859,7 @@ analyzer_audio_module::analyzer_audio_module() {
meter_R = 0.f;
_accuracy = -1;
_acc_old = -1;
+ _mode_old = -1;
ppos = 0;
plength = 0;
fpos = 0;
@@ -1224,3 +1225,27 @@ bool analyzer_audio_module::get_graph(int index, int subindex, float *data, int
return true;
}
+bool analyzer_audio_module::get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context) const
+{
+ bool out;
+ if(*params[param_analyzer_mode] != 3)
+ out = get_freq_gridline(subindex, pos, vertical, legend, context);
+ else
+ out = get_freq_gridline(subindex, pos, vertical, legend, context, true, 16, 0.0000000001f);
+ if(*params[param_analyzer_mode] == 3 and not vertical) {
+ if(subindex == 30)
+ legend="L";
+ else if(subindex == 34)
+ legend="R";
+ else
+ legend = "";
+ }
+ return out;
+}
+bool analyzer_audio_module::get_clear_all(int index) const {
+ if(*params[param_analyzer_mode] != _mode_old) {
+ _mode_old = *params[param_analyzer_mode];
+ return true;
+ }
+ return false;
+}
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list