[SCM] calf/master: Merge commit 'origin/caching'
js at users.alioth.debian.org
js at users.alioth.debian.org
Tue May 7 15:39:10 UTC 2013
+ Framework meter caching, fix whitespace and meter inversion
+ Framework cache meter background (intermediate commit, before whitespace fix)
+ Compressor add graph caching support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: d6a3c1a63a147948535a50da009275278ad5e6a3
X-Git-Newrev: 34569260c452f0fa4c543155ebba174a42a343dc
The following commit has been merged in the master branch:
commit be02ac2de7c0a701d1e9a533dc9055d8c53302b6
Merge: a8ea924f0cb442756d42001c970a17d3e75fba06 de7d77a09c5cb65e2297178d6ea03f59928cf54b
Author: Krzysztof Foltman <wdev at foltman.com>
Date: Sun Jan 25 12:50:00 2009 +0000
Merge commit 'origin/caching'
Conflicts:
src/calf/custom_ctl.h
diff --combined src/calf/custom_ctl.h
index 39ade93,cc076c8..8b37359
--- a/src/calf/custom_ctl.h
+++ b/src/calf/custom_ctl.h
@@@ -55,13 -55,12 +55,14 @@@ extern GType calf_line_graph_get_type()
extern void calf_line_graph_set_square(CalfLineGraph *graph, bool is_square);
+extern void calf_line_graph_update_if(CalfLineGraph *graph);
+
- #define CALF_TYPE_VUMETER (calf_vumeter_get_type())
- #define CALF_VUMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_VUMETER, CalfVUMeter))
- #define CALF_IS_VUMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_VUMETER))
- #define CALF_VUMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_VUMETER, CalfVUMeterClass))
- #define CALF_IS_VUMETER_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_VUMETER))
+ #define CALF_TYPE_VUMETER (calf_vumeter_get_type())
+ #define CALF_VUMETER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALF_TYPE_VUMETER, CalfVUMeter))
+ #define CALF_IS_VUMETER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALF_TYPE_VUMETER))
+ #define CALF_VUMETER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALF_TYPE_VUMETER, CalfVUMeterClass))
+ #define CALF_IS_VUMETER_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALF_TYPE_VUMETER))
+ #define CALF_VUMETER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALF_TYPE_VUMETER, CalfVUMeterClass))
enum CalfVUMeterMode
{
@@@ -75,6 -74,7 +76,7 @@@ struct CalfVUMete
GtkDrawingArea parent;
CalfVUMeterMode mode;
float value;
+ cairo_surface_t *cache_surface;
};
struct CalfVUMeterClass
diff --combined src/calf/modules.h
index efebfea,1cbcfd2..f3dd1fc
--- a/src/calf/modules.h
+++ b/src/calf/modules.h
@@@ -22,7 -22,6 +22,7 @@@
#define __CALF_MODULES_H
#include <assert.h>
+#include <limits.h>
#include "biquad.h"
#include "inertia.h"
#include "audio_fx.h"
@@@ -721,7 -720,20 +721,7 @@@ public
}
bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context);
- int get_changed_offsets(int generation, int &subindex_graph, int &subindex_dot, int &subindex_gridline)
- {
- if (fabs(inertia_cutoff.get_last() - old_cutoff) + 100 * fabs(inertia_resonance.get_last() - old_resonance) + fabs(*params[par_mode] - old_mode) > 0.1f)
- {
- old_cutoff = inertia_cutoff.get_last();
- old_resonance = inertia_resonance.get_last();
- old_mode = *params[par_mode];
- last_generation++;
- }
- frequency_response_line_graph::get_changed_offsets(generation, subindex_graph, subindex_dot, subindex_gridline);
- if (generation == last_generation)
- subindex_graph = 2;
- return last_generation;
- }
+ int get_changed_offsets(int generation, int &subindex_graph, int &subindex_dot, int &subindex_gridline);
};
/// A multitap stereo chorus thing - processing
@@@ -788,6 -800,8 +788,8 @@@ public
class compressor_audio_module: public audio_module<compressor_metadata>, public line_graph_iface {
private:
float linSlope, peak, detected, kneeSqrt, kneeStart, linKneeStart, kneeStop, threshold, ratio, knee, makeup, compressedKneeStop, adjKneeStart;
+ float old_threshold, old_ratio, old_knee, old_makeup;
+ int last_generation;
uint32_t clip;
aweighter awL, awR;
public:
@@@ -800,7 -814,7 +802,7 @@@
void activate();
void deactivate();
uint32_t process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask);
-
+
inline float output_level(float slope) {
return slope * output_gain(slope, false) * makeup;
}
@@@ -835,6 -849,26 +837,26 @@@
virtual bool get_graph(int index, int subindex, float *data, int points, cairo_iface *context);
virtual bool get_dot(int index, int subindex, float &x, float &y, int &size, cairo_iface *context);
virtual bool get_gridline(int index, int subindex, float &pos, bool &vertical, std::string &legend, cairo_iface *context);
+
+ virtual int get_changed_offsets(int generation, int &subindex_graph, int &subindex_dot, int &subindex_gridline)
+ {
+ subindex_graph = 0;
+ subindex_dot = 0;
+ subindex_gridline = generation ? INT_MAX : 0;
+
+ if (fabs(threshold-old_threshold) + fabs(ratio - old_ratio) + fabs(knee - old_knee) + fabs( makeup - old_makeup) > 0.1f)
+ {
+ old_threshold = threshold;
+ old_ratio = ratio;
+ old_knee = knee;
+ old_makeup = makeup;
+ last_generation++;
+ }
+
+ if (generation == last_generation)
+ subindex_graph = 2;
+ return last_generation;
+ }
};
/// Filterclavier --- MIDI controlled filter by Hans Baier
diff --combined src/custom_ctl.cpp
index c2a4c88,4c01e92..57961bf
--- a/src/custom_ctl.cpp
+++ b/src/custom_ctl.cpp
@@@ -258,20 -258,6 +258,20 @@@ void calf_line_graph_set_square(CalfLin
graph->is_square = is_square;
}
+void calf_line_graph_update_if(CalfLineGraph *graph)
+{
+ g_assert(CALF_IS_LINE_GRAPH(graph));
+ int generation = 0;
+ if (graph->source)
+ {
+ int subgraph, dot, gridline;
+ generation = graph->source->get_changed_offsets(graph->last_generation, subgraph, dot, gridline);
+ if (subgraph == INT_MAX && dot == INT_MAX && gridline == INT_MAX)
+ return;
+ gtk_widget_queue_draw(GTK_WIDGET(graph));
+ }
+}
+
static void
calf_line_graph_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@@@ -389,49 -375,74 +389,74 @@@ calf_vumeter_expose (GtkWidget *widget
cairo_t *c = gdk_cairo_create(GDK_DRAWABLE(widget->window));
- GdkColor sc = { 0, 0, 0, 0 };
- gdk_cairo_set_source_color(c, &sc);
- cairo_rectangle(c, ox, oy, sx, sy);
- cairo_fill(c);
- cairo_set_line_width(c, 1);
-
- CalfVUMeterMode mode = vu->mode;
+ if( vu->cache_surface == NULL ) {
+ // looks like its either first call or the widget has been resized.
+ // create the cache_surface.
+ cairo_surface_t *window_surface = cairo_get_target( c );
+ vu->cache_surface = cairo_surface_create_similar( window_surface,
+ CAIRO_CONTENT_COLOR,
+ widget->allocation.width,
+ widget->allocation.height );
+
+ // And render the meterstuff again.
- for (int x = ox; x <= ox + sx; x += 3)
- {
- float ts = (x - ox) * 1.0 / sx;
- float r = 0.f, g = 0.f, b = 0.f;
- switch(mode)
- {
- case VU_STANDARD:
- default:
- if (ts < 0.75)
- r = ts / 0.75, g = 1, b = 0;
- else
- r = 1, g = 1 - (ts - 0.75) / 0.25, b = 0;
- if (vu->value < ts || vu->value <= 0)
- r *= 0.5, g *= 0.5, b *= 0.5;
- break;
- case VU_MONOCHROME_REVERSE:
- r = 1, g = 1, b = 0;
- if (!(vu->value < ts) || vu->value >= 1.0)
- r *= 0.5, g *= 0.5, b *= 0.5;
- break;
- case VU_MONOCHROME:
- r = 1, g = 1, b = 0;
- if (vu->value < ts || vu->value <= 0)
- r *= 0.5, g *= 0.5, b *= 0.5;
- break;
- }
- GdkColor sc2 = { 0, (guint16)(65535 * r), (guint16)(65535 * g), (guint16)(65535 * b) };
- gdk_cairo_set_source_color(c, &sc2);
- cairo_move_to(c, x, oy);
- cairo_line_to(c, x, oy + sy + 1);
- cairo_move_to(c, x, oy + sy);
- cairo_line_to(c, x, oy );
- cairo_stroke(c);
+ cairo_t *cache_cr = cairo_create( vu->cache_surface );
+ GdkColor sc = { 0, 0, 0, 0 };
+ gdk_cairo_set_source_color(cache_cr, &sc);
+ cairo_rectangle(cache_cr, ox, oy, sx, sy);
+ cairo_fill(cache_cr);
+ cairo_set_line_width(cache_cr, 1);
+
+ for (int x = ox; x <= ox + sx; x += 3)
+ {
+ float ts = (x - ox) * 1.0 / sx;
+ float r = 0.f, g = 0.f, b = 0.f;
+ switch(vu->mode)
+ {
+ case VU_STANDARD:
+ default:
+ if (ts < 0.75)
+ r = ts / 0.75, g = 1, b = 0;
+ else
+ r = 1, g = 1 - (ts - 0.75) / 0.25, b = 0;
+ // if (vu->value < ts || vu->value <= 0)
+ // r *= 0.5, g *= 0.5, b *= 0.5;
+ break;
+ case VU_MONOCHROME_REVERSE:
+ r = 1, g = 1, b = 0;
+ // if (!(vu->value < ts) || vu->value >= 1.0)
+ // r *= 0.5, g *= 0.5, b *= 0.5;
+ break;
+ case VU_MONOCHROME:
+ r = 1, g = 1, b = 0;
+ // if (vu->value < ts || vu->value <= 0)
+ // r *= 0.5, g *= 0.5, b *= 0.5;
+ break;
+ }
+ GdkColor sc2 = { 0, (guint16)(65535 * r), (guint16)(65535 * g), (guint16)(65535 * b) };
+ gdk_cairo_set_source_color(cache_cr, &sc2);
+ cairo_move_to(cache_cr, x, oy);
+ cairo_line_to(cache_cr, x, oy + sy + 1);
+ cairo_move_to(cache_cr, x, oy + sy);
+ cairo_line_to(cache_cr, x, oy );
+ cairo_stroke(cache_cr);
+ }
+ cairo_destroy( cache_cr );
}
+ cairo_set_source_surface( c, vu->cache_surface, 0,0 );
+ cairo_paint( c );
+ cairo_set_source_rgba( c, 0,0,0, 0.5 );
+
+ if( vu->mode == VU_MONOCHROME_REVERSE )
+ cairo_rectangle( c, ox,oy, vu->value * (sx-ox), sy-oy );
+ else
+ cairo_rectangle( c, vu->value * (sx-ox),oy, sx-ox, sy-oy );
+
+ cairo_fill( c );
+
+
+
cairo_destroy(c);
gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN, NULL, widget, NULL, ox - 1, oy - 1, sx + 2, sy + 2);
@@@ -455,8 -466,15 +480,15 @@@ calf_vumeter_size_allocate (GtkWidget *
GtkAllocation *allocation)
{
g_assert(CALF_IS_VUMETER(widget));
+ CalfVUMeter *vu = CALF_VUMETER(widget);
- widget->allocation = *allocation;
+ GtkWidgetClass *parent_class = (GtkWidgetClass *) g_type_class_peek_parent( CALF_VUMETER_GET_CLASS( vu ) );
+
+ parent_class->size_allocate( widget, allocation );
+
+ if( vu->cache_surface )
+ cairo_surface_destroy( vu->cache_surface );
+ vu->cache_surface = NULL;
}
static void
@@@ -465,7 -483,7 +497,7 @@@ calf_vumeter_class_init (CalfVUMeterCla
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
widget_class->expose_event = calf_vumeter_expose;
widget_class->size_request = calf_vumeter_size_request;
- //widget_class->size_allocate = calf_vumeter_size_allocate;
+ widget_class->size_allocate = calf_vumeter_size_allocate;
}
static void
@@@ -476,6 -494,7 +508,7 @@@ calf_vumeter_init (CalfVUMeter *self
widget->requisition.width = 50;
widget->requisition.height = 15;
self->value = 0.5;
+ self->cache_surface = NULL;
}
GtkWidget *
diff --combined src/modules_dsp.cpp
index 1e3fae0,c8706b7..c005918
--- a/src/modules_dsp.cpp
+++ b/src/modules_dsp.cpp
@@@ -243,28 -243,6 +243,28 @@@ bool filter_audio_module::get_graph(in
return false;
}
+int filter_audio_module::get_changed_offsets(int generation, int &subindex_graph, int &subindex_dot, int &subindex_gridline)
+{
+ if (fabs(inertia_cutoff.get_last() - old_cutoff) + 100 * fabs(inertia_resonance.get_last() - old_resonance) + fabs(*params[par_mode] - old_mode) > 0.1f)
+ {
+ old_cutoff = inertia_cutoff.get_last();
+ old_resonance = inertia_resonance.get_last();
+ old_mode = *params[par_mode];
+ last_generation++;
+ subindex_graph = 0;
+ subindex_dot = INT_MAX;
+ subindex_gridline = INT_MAX;
+ }
+ else {
+ subindex_graph = 0;
+ subindex_dot = subindex_gridline = generation ? INT_MAX : 0;
+ }
+ if (generation == last_generation)
+ subindex_graph = INT_MAX;
+ return last_generation;
+}
+
+
///////////////////////////////////////////////////////////////////////////////////////////////
bool filterclavier_audio_module::get_graph(int index, int subindex, float *data, int points, cairo_iface *context)
@@@ -420,6 -398,7 +420,7 @@@ compressor_audio_module::compressor_aud
{
is_active = false;
srate = 0;
+ last_generation = 0;
}
void compressor_audio_module::activate()
--
calf audio plugins packaging
More information about the pkg-multimedia-commits
mailing list