[Ardour-Dev] Fwd: [Ardour-Cvs] Ardour source branch meterbridge updated. 3.2-153-gf885622
Jörn Nettingsmeier
nettings at stackingdwarves.net
Sat Jul 6 09:27:39 PDT 2013
hi robin, i'm not currently tracking the meterbridge branch, so i may be
talking nonsense, but here goes:
peaking should be defined as a configurable number of samples at full
scale (or equal to or greater than 1.0f, in the case of floats) , not
some arbitary level.
best,
jörn
-------- Original Message --------
Subject: [Ardour-Cvs] Ardour source branch meterbridge updated.
3.2-153-gf885622
Date: Sat, 6 Jul 2013 14:33:05 +0000
From: admin at ardour.org
To: ardour-cvs at lists.ardour.org
- Log -----------------------------------------------------------------
commit f8856225b0b8a4445dcb9d5acf295ca2775d462d
Author: Robin Gareus <robin at gareus.org>
Date: Sat Jul 6 16:32:36 2013 +0200
highlight meter-background of a port that has peaked (experiment)
diff --git a/gtk2_ardour/level_meter.cc b/gtk2_ardour/level_meter.cc
index cf16107..d0f46f0 100644
--- a/gtk2_ardour/level_meter.cc
+++ b/gtk2_ardour/level_meter.cc
@@ -100,19 +100,21 @@ LevelMeter::update_meters ()
for (n = 0, i = meters.begin(); i != meters.end(); ++i, ++n) {
if ((*i).packed) {
+ mpeak = _meter->max_peak_power(n);
+ if (mpeak > (*i).max_peak) {
+ (*i).max_peak = mpeak;
+ (*i).meter->set_highlight(mpeak > Config->get_meter_peak());
+ }
+ if (mpeak > max_peak) {
+ max_peak = mpeak;
+ }
+
peak = _meter->peak_power (n);
if (n < nmidi) {
(*i).meter->set (peak);
} else {
(*i).meter->set (log_meter (peak));
}
- mpeak = _meter->max_peak_power(n);
- if (mpeak > max_peak) {
- max_peak = mpeak;
- }
- if (mpeak > max_peak) {
- max_peak = mpeak;
- }
}
}
return max_peak;
@@ -293,6 +295,8 @@ void LevelMeter::clear_meters ()
{
for (vector<MeterInfo>::iterator i = meters.begin(); i <
meters.end(); i++) {
(*i).meter->clear();
+ (*i).max_peak = minus_infinity();
+ (*i).meter->set_highlight(false);
}
max_peak = minus_infinity();
}
diff --git a/gtk2_ardour/level_meter.h b/gtk2_ardour/level_meter.h
index bf9f42a..0792872 100644
--- a/gtk2_ardour/level_meter.h
+++ b/gtk2_ardour/level_meter.h
@@ -80,12 +80,14 @@ class LevelMeter : public Gtk::HBox, public
ARDOUR::SessionHandlePtr
gint16 width;
int length;
bool packed;
+ float max_peak;
MeterInfo() {
meter = 0;
width = 0;
length = 0;
packed = false;
+ max_peak = -INFINITY;
}
};
commit 4236a7247b3afd3ca719fcc1f8fec0514d0eeb91
Author: Robin Gareus <robin at gareus.org>
Date: Sat Jul 6 16:30:30 2013 +0200
prepare meter-widget for dual background color
diff --git a/gtk2_ardour/level_meter.cc b/gtk2_ardour/level_meter.cc
index 7a32b47..cf16107 100644
--- a/gtk2_ardour/level_meter.cc
+++ b/gtk2_ardour/level_meter.cc
@@ -254,6 +254,7 @@ LevelMeter::setup_meters (int len, int
initial_width, int thin_width)
c[5], c[6], c[7], c[8], c[9],
ARDOUR_UI::config()->canvasvar_MeterBackgroundBot.get(),
ARDOUR_UI::config()->canvasvar_MeterBackgroundTop.get(),
+ 0x991122ff, 0x551111ff,
stp[0], stp[1], stp[2], stp[3]
);
meters[n].width = width;
diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc
index 57d53c8..7c0e60a 100644
--- a/libs/gtkmm2ext/fastmeter.cc
+++ b/libs/gtkmm2ext/fastmeter.cc
@@ -44,7 +44,9 @@ FastMeter::PatternBgMap FastMeter::vb_pattern_cache;
FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o,
int len,
int clr0, int clr1, int clr2, int clr3,
int clr4, int clr5, int clr6, int clr7,
- int clr8, int clr9, int bgc0, int bgc1,
+ int clr8, int clr9,
+ int bgc0, int bgc1,
+ int bgh0, int bgh1,
float stp0, float stp1,
float stp2, float stp3
)
@@ -58,6 +60,8 @@ FastMeter::FastMeter (long hold, unsigned long dimen,
Orientation o, int len,
last_peak_rect.width = 0;
last_peak_rect.height = 0;
+ highlight = false;
+
_clr[0] = clr0;
_clr[1] = clr1;
_clr[2] = clr2;
@@ -72,6 +76,9 @@ FastMeter::FastMeter (long hold, unsigned long dimen,
Orientation o, int len,
_bgc[0] = bgc0;
_bgc[1] = bgc1;
+ _bgh[0] = bgh0;
+ _bgh[1] = bgh1;
+
_stp[0] = stp0;
_stp[1] = stp1;
_stp[2] = stp2;
@@ -85,8 +92,8 @@ FastMeter::FastMeter (long hold, unsigned long dimen,
Orientation o, int len,
if (!len) {
len = 250;
}
- fgpattern = request_vertical_meter(dimen, len, _clr, _stp);
- bgpattern = request_vertical_background (dimen, len, _bgc);
+ fgpattern = request_vertical_meter(dimen, len, _clr, _stp, true);
+ bgpattern = request_vertical_background (dimen, len, _bgc, false);
pixheight = len;
pixwidth = dimen;
@@ -95,6 +102,8 @@ FastMeter::FastMeter (long hold, unsigned long dimen,
Orientation o, int len,
request_width = pixrect.width + 2;
request_height= pixrect.height + 2;
+
+ queue_draw ();
}
FastMeter::~FastMeter ()
@@ -103,7 +112,7 @@ FastMeter::~FastMeter ()
Cairo::RefPtr<Cairo::Pattern>
FastMeter::generate_meter_pattern (
- int width, int height, int *clr, float *stp)
+ int width, int height, int *clr, float *stp, bool shade)
{
guint8 r,g,b,a;
double knee;
@@ -164,7 +173,7 @@ FastMeter::generate_meter_pattern (
cairo_pattern_add_color_stop_rgb (pat, 1.0,
r/255.0, g/255.0, b/255.0);
- if (1) { // TODO Config->get_meter_shade()
+ if (shade) {
cairo_pattern_t* shade_pattern = cairo_pattern_create_linear (0.0,
0.0, width, 0.0);
cairo_pattern_add_color_stop_rgba (shade_pattern, 0, 1.0, 1.0, 1.0,
0.2);
cairo_pattern_add_color_stop_rgba (shade_pattern, 1, 0.0, 0.0, 0.0,
0.3);
@@ -197,11 +206,11 @@ FastMeter::generate_meter_pattern (
Cairo::RefPtr<Cairo::Pattern>
FastMeter::generate_meter_background (
- int width, int height, int *clr)
+ int width, int height, int *clr, bool shade)
{
guint8 r0,g0,b0,r1,g1,b1,a;
- cairo_pattern_t* pat = cairo_pattern_create_linear (0.0, 0.0, width,
height);
+ cairo_pattern_t* pat = cairo_pattern_create_linear (0.0, 0.0, 0.0,
height);
UINT_TO_RGBA (clr[0], &r0, &g0, &b0, &a);
UINT_TO_RGBA (clr[1], &r1, &g1, &b1, &a);
@@ -212,6 +221,32 @@ FastMeter::generate_meter_background (
cairo_pattern_add_color_stop_rgb (pat, 1.0,
r0/255.0, g0/255.0, b0/255.0);
+ if (shade) {
+ cairo_pattern_t* shade_pattern = cairo_pattern_create_linear (0.0,
0.0, width, 0.0);
+ cairo_pattern_add_color_stop_rgba (shade_pattern, 0.0, 1.0, 1.0, 1.0,
0.15);
+ cairo_pattern_add_color_stop_rgba (shade_pattern, 0.6, 0.0, 0.0, 0.0,
0.10);
+ cairo_pattern_add_color_stop_rgba (shade_pattern, 1.0, 1.0, 1.0, 1.0,
0.20);
+
+ cairo_surface_t* surface;
+ cairo_t* tc = 0;
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width,
height);
+ tc = cairo_create (surface);
+ cairo_set_source (tc, pat);
+ cairo_rectangle (tc, 0, 0, width, height);
+ cairo_fill (tc);
+ cairo_set_source (tc, shade_pattern);
+ cairo_rectangle (tc, 0, 0, width, height);
+ cairo_fill (tc);
+
+ cairo_pattern_destroy (pat);
+ cairo_pattern_destroy (shade_pattern);
+
+ pat = cairo_pattern_create_for_surface (surface);
+
+ cairo_destroy (tc);
+ cairo_surface_destroy (surface);
+ }
+
Cairo::RefPtr<Cairo::Pattern> p (new Cairo::Pattern (pat, false));
return p;
@@ -219,7 +254,7 @@ FastMeter::generate_meter_background (
Cairo::RefPtr<Cairo::Pattern>
FastMeter::request_vertical_meter(
- int width, int height, int *clr, float *stp)
+ int width, int height, int *clr, float *stp, bool shade)
{
if (height < min_pattern_metric_size)
height = min_pattern_metric_size;
@@ -239,7 +274,7 @@ FastMeter::request_vertical_meter(
// TODO flush pattern cache if it gets too large
Cairo::RefPtr<Cairo::Pattern> p = generate_meter_pattern (
- width, height, clr, stp);
+ width, height, clr, stp, shade);
vm_pattern_cache[key] = p;
return p;
@@ -247,7 +282,7 @@ FastMeter::request_vertical_meter(
Cairo::RefPtr<Cairo::Pattern>
FastMeter::request_vertical_background(
- int width, int height, int *bgc)
+ int width, int height, int *bgc, bool shade)
{
if (height < min_pattern_metric_size)
height = min_pattern_metric_size;
@@ -262,7 +297,7 @@ FastMeter::request_vertical_background(
// TODO flush pattern cache if it gets too large
Cairo::RefPtr<Cairo::Pattern> p = generate_meter_background (
- width, height, bgc);
+ width, height, bgc, shade);
vb_pattern_cache[key] = p;
return p;
@@ -310,8 +345,8 @@ FastMeter::on_size_allocate (Gtk::Allocation &alloc)
}
if (pixheight != h) {
- fgpattern = request_vertical_meter (request_width, h, _clr, _stp);
- bgpattern = request_vertical_background (request_width, h, _bgc);
+ fgpattern = request_vertical_meter (request_width, h, _clr, _stp, true);
+ bgpattern = request_vertical_background (request_width, h, highlight
? _bgh : _bgc, highlight);
pixheight = h - 2;
pixwidth = request_width - 2;
}
@@ -339,7 +374,9 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
if (resized) {
cairo_set_source_rgb (cr, 0, 0, 0); // black
rounded_rectangle (cr, 0, 0, pixrect.width + 2, pixheight + 2, 2);
- cairo_fill (cr);
+ cairo_stroke (cr);
+ //cairo_fill (cr);
+ //resized = false;
}
cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width,
ev->area.height);
@@ -490,10 +527,24 @@ FastMeter::queue_vertical_redraw (const
Glib::RefPtr<Gdk::Window>& win, float ol
}
void
+FastMeter::set_highlight (bool onoff)
+{
+ if (highlight == onoff) {
+ return;
+ }
+ highlight = onoff;
+ bgpattern = request_vertical_background (request_width, pixheight,
highlight ? _bgh : _bgc, highlight);
+ resized = true;
+ queue_draw ();
+}
+
+void
FastMeter::clear ()
{
current_level = 0;
current_peak = 0;
hold_state = 0;
+ set_highlight(false);
+ resized = true;
queue_draw ();
}
diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
index ac81f46..026289c 100644
--- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
+++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h
@@ -43,6 +43,7 @@ class FastMeter : public Gtk::DrawingArea {
int clr6=0xffff00ff, int clr7=0xffff00ff,
int clr8=0xff0000ff, int clr9=0xff0000ff,
int bgc0=0x333333ff, int bgc1=0x444444ff,
+ int bgh0=0x991122ff, int bgh1=0x551111ff,
float stp0 = 55.0, // log_meter(-18);
float stp1 = 77.5, // log_meter(-9);
float stp2 = 92.5, // log_meter(-3); // 95.0, // log_meter(-2);
@@ -59,6 +60,8 @@ class FastMeter : public Gtk::DrawingArea {
long hold_count() { return hold_cnt; }
void set_hold_count (long);
+ void set_highlight (bool);
+ bool get_highlight () { return highlight; }
protected:
bool on_expose_event (GdkEventExpose*);
@@ -75,6 +78,7 @@ private:
float _stp[4];
int _clr[10];
int _bgc[2];
+ int _bgh[2];
Orientation orientation;
GdkRectangle pixrect;
@@ -87,19 +91,20 @@ private:
float current_peak;
float current_user_level;
bool resized;
+ bool highlight;
bool vertical_expose (GdkEventExpose*);
void queue_vertical_redraw (const Glib::RefPtr<Gdk::Window>&, float);
static Cairo::RefPtr<Cairo::Pattern> generate_meter_pattern (
- int w, int h, int *clr, float *stp);
+ int w, int h, int *clr, float *stp, bool shade);
static Cairo::RefPtr<Cairo::Pattern> request_vertical_meter (
- int w, int h, int *clr, float *stp);
+ int w, int h, int *clr, float *stp, bool shade);
static Cairo::RefPtr<Cairo::Pattern> generate_meter_background (
- int w, int h, int *bgc);
+ int w, int h, int *bgc, bool shade);
static Cairo::RefPtr<Cairo::Pattern> request_vertical_background (
- int w, int h, int *bgc);
+ int w, int h, int *bgc, bool shade);
struct Pattern10MapKey {
Pattern10MapKey (
commit 4ac79b7d691e1f7b9d85bca8714cf980fba9fef2
Author: Robin Gareus <robin at gareus.org>
Date: Sat Jul 6 16:10:00 2013 +0200
fix HSlider Option
diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h
index 1ee4baa..2073da5 100644
--- a/gtk2_ardour/option_editor.h
+++ b/gtk2_ardour/option_editor.h
@@ -308,6 +308,7 @@ public:
_label = manage (new Gtk::Label (n + ":"));
_label->set_alignment (0, 0.5);
_hscale = manage (new Gtk::HScale(adj));
+ _adj = NULL;
}
HSliderOption (
commit 5b4eea7d5f21c6818549534e320a06fd205dfc27
Author: Robin Gareus <robin at gareus.org>
Date: Sat Jul 6 16:09:38 2013 +0200
make changes to peak-meter threshold config effective immediately
diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc
index 767754b..dcc89e1 100644
--- a/gtk2_ardour/gain_meter.cc
+++ b/gtk2_ardour/gain_meter.cc
@@ -843,10 +843,9 @@ GainMeterBase::update_meters()
snprintf (buf, sizeof(buf), "%.1f", mpeak);
peak_display.set_label (buf);
}
-
- if (mpeak >= Config->get_meter_peak()) {
- peak_display.set_name ("MixerStripPeakDisplayPeak");
- }
+ }
+ if (mpeak >= Config->get_meter_peak()) {
+ peak_display.set_name ("MixerStripPeakDisplayPeak");
}
}
diff --git a/gtk2_ardour/meter_strip.cc b/gtk2_ardour/meter_strip.cc
index fcb3561..a287206 100644
--- a/gtk2_ardour/meter_strip.cc
+++ b/gtk2_ardour/meter_strip.cc
@@ -192,6 +192,7 @@ MeterStrip::MeterStrip (Session* sess,
boost::shared_ptr<ARDOUR::Route> rt)
UI::instance()->theme_changed.connect (sigc::mem_fun(*this,
&MeterStrip::on_theme_changed));
ColorsChanged.connect (sigc::mem_fun (*this,
&MeterStrip::on_theme_changed));
DPIReset.connect (sigc::mem_fun (*this, &MeterStrip::on_theme_changed));
+ Config->ParameterChanged.connect (*this, invalidator (*this), ui_bind
(&MeterStrip::parameter_changed, this, _1), gui_context());
}
MeterStrip::~MeterStrip ()
@@ -417,3 +418,11 @@ MeterStrip::redraw_metrics ()
meter_ticks1_area.queue_draw();
meter_ticks2_area.queue_draw();
}
+
+void
+MeterStrip::parameter_changed (std::string const & p)
+{
+ if (p == "meter-peak") {
+ max_peak = -INFINITY;
+ }
+}
diff --git a/gtk2_ardour/meter_strip.h b/gtk2_ardour/meter_strip.h
index c50c810..4589742 100644
--- a/gtk2_ardour/meter_strip.h
+++ b/gtk2_ardour/meter_strip.h
@@ -112,6 +112,7 @@ class MeterStrip : public Gtk::VBox, public RouteUI
bool peak_button_release (GdkEventButton*);
+ void parameter_changed (std::string const & p);
void redraw_metrics ();
};
-----------------------------------------------------------------------
Summary of changes:
gtk2_ardour/gain_meter.cc | 7 ++-
gtk2_ardour/level_meter.cc | 19 +++++---
gtk2_ardour/level_meter.h | 2 +
gtk2_ardour/meter_strip.cc | 9 ++++
gtk2_ardour/meter_strip.h | 1 +
gtk2_ardour/option_editor.h | 1 +
libs/gtkmm2ext/fastmeter.cc | 79
++++++++++++++++++++++++++++------
libs/gtkmm2ext/gtkmm2ext/fastmeter.h | 13 ++++--
8 files changed, 102 insertions(+), 29 deletions(-)
hooks/post-receive
--
Ardour source
_______________________________________________
Ardour-Cvs mailing list
This list is read-only.
http://lists.ardour.org/listinfo.cgi/ardour-cvs-ardour.org
More information about the Ardour-Dev
mailing list