diff options
author | David Robillard <d@drobilla.net> | 2011-08-31 18:58:46 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-08-31 18:58:46 +0000 |
commit | f3a6b8a9bae2c926dd37315793416f14c176bbd8 (patch) | |
tree | df09d3f0391e763370d58b8e75c60b3c2203c708 | |
parent | c55f142ad055a9b40064a4d1f5399b8361c779c6 (diff) |
Fix meter colour range to again have a hard knee at 0dB and twiddle colours so >0dB levels are red and stand out.
I am not sure if this is the original intent here, but it seems the most informative/useful/standard/etc. Unfortunately the colour names in the configuration (min, mid, max, clip) are a bit confusing (starting to clip = "mid"?) but changing them would break things. Oh well.
git-svn-id: svn://localhost/ardour2/branches/3.0@10042 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/ardour3_ui_default.conf | 14 | ||||
-rw-r--r-- | libs/gtkmm2ext/fastmeter.cc | 44 |
2 files changed, 38 insertions, 20 deletions
diff --git a/gtk2_ardour/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf index 303b9b3c27..196bb89710 100644 --- a/gtk2_ardour/ardour3_ui_default.conf +++ b/gtk2_ardour/ardour3_ui_default.conf @@ -51,14 +51,14 @@ <Option name="measure line bar" value="d7d9d99c"/> <Option name="measure line beat" value="b5b5b576"/> <Option name="meter bar" value="626470ff"/> - <Option name="meter fill min" value="0000ffff"/> + <Option name="meter fill min" value="00ff00ff"/> <Option name="meter fill clip" value="ff0000ff"/> - <Option name="meter fill mid" value="73f9baff"/> - <Option name="meter fill max" value="00fd5dff"/> - <Option name="midi meter fill min" value="effaa100"/> - <Option name="midi meter fill clip" value="f83913ff"/> - <Option name="midi meter fill mid" value="8fc78e00"/> - <Option name="midi meter fill max" value="00f45600"/> + <Option name="meter fill mid" value="ffff00ff"/> + <Option name="meter fill max" value="991e1eff"/> + <Option name="midi meter fill min" value="3f542aff"/> + <Option name="midi meter fill clip" value="ff0000ff"/> + <Option name="midi meter fill mid" value="bfff80ff"/> + <Option name="midi meter fill max" value="991e1eff"/> <Option name="meter marker" value="f2425bff"/> <Option name="midi bus base" value="00000000"/> <Option name="midi frame base" value="393d3766"/> diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc index 79d2871459..a2b9e5fe12 100644 --- a/libs/gtkmm2ext/fastmeter.cc +++ b/libs/gtkmm2ext/fastmeter.cc @@ -94,10 +94,16 @@ FastMeter::generate_meter_pattern ( { guint8 r0,g0,b0,r1,g1,b1,r2,g2,b2,r3,g3,b3,a; - /* clr0: color at top of the meter - 1: color at the knee - 2: color half-way between bottom and knee - 3: color at the bottom of the meter + /* + The knee is the hard transition point (e.g. at 0dB where the colors + change dramatically to make clipping apparent). Thus there are two + gradients in the pattern, the "normal range" and the "clip range", which + are separated at the knee point. + + clr0: color at bottom of normal range gradient + clr1: color at top of normal range gradient + clr2: color at bottom of clip range gradient + clr3: color at top of clip range gradient */ UINT_TO_RGBA (clr0, &r0, &g0, &b0, &a); @@ -112,18 +118,30 @@ FastMeter::generate_meter_pattern ( // return def / 115.0f const int knee = (int)floor((float)height * 100.0f / 115.0f); - cairo_pattern_t* _p = cairo_pattern_create_linear (0.0, 0.0, width, height); + cairo_pattern_t* pat = cairo_pattern_create_linear (0.0, 0.0, width, height); - /* cairo coordinate space goes downwards as y value goes up, so invert - * knee-based positions by using (1.0 - y) - */ + /* + Cairo coordinate space goes downwards as y value goes up, so invert + knee-based positions by using (1.0 - y) + */ + + // Clip range top + cairo_pattern_add_color_stop_rgb (pat, 0.0, + r3/255.0, g3/255.0, b3/255.0); + + // Clip range bottom + cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height), + r2/255.0, g2/255.0, b2/255.0); + + // Normal range top (double-stop at knee) + cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height), + r1/255.0, g1/255.0, b1/255.0); - cairo_pattern_add_color_stop_rgb (_p, 0.0, r3/255.0, g3/255.0, b3/255.0); // bottom - cairo_pattern_add_color_stop_rgb (_p, 1.0 - (knee/(double)height), r2/255.0, g2/255.0, b2/255.0); // mid-point to knee - cairo_pattern_add_color_stop_rgb (_p, 1.0 - (knee/(2.0 * height)), r1/255.0, g1/255.0, b1/255.0); // knee to top - cairo_pattern_add_color_stop_rgb (_p, 1.0, r0/255.0, g0/255.0, b0/255.0); // top + // Normal range bottom + cairo_pattern_add_color_stop_rgb (pat, 1.0, + r0/255.0, g0/255.0, b0/255.0); // top - Cairo::RefPtr<Cairo::Pattern> p (new Cairo::Pattern (_p, false)); + Cairo::RefPtr<Cairo::Pattern> p (new Cairo::Pattern (pat, false)); return p; } |