make all meter-colors configurable,..

This commit is contained in:
Robin Gareus 2013-07-04 01:29:59 +02:00
parent 571b2d70e9
commit 8a16e61b11
5 changed files with 95 additions and 47 deletions

View File

@ -51,17 +51,28 @@
<Option name="measure line bar" value="ffffff9c"/>
<Option name="measure line beat" value="a29e9e76"/>
<Option name="meter bar" value="626470cc"/>
<Option name="meter fill min" value="0000ffff"/>
<Option name="meter fill clip" value="ff0000ff"/>
<Option name="meter fill mid" value="73f9baff"/>
<Option name="meter fill max" value="00fd5dff"/>
<Option name="meter background bottom" value="333333ff"/>
<Option name="meter background mid" value="444444ff"/>
<Option name="meter background top" value="444444ff"/>
<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: 0" value="008800ff"/>
<Option name="meter fill: 1" value="008800ff"/>
<Option name="meter fill: 2" value="00ff00ff"/>
<Option name="meter fill: 3" value="00ff00ff"/>
<Option name="meter fill: 4" value="fff000ff"/>
<Option name="meter fill: 5" value="fff000ff"/>
<Option name="meter fill: 6" value="ff8000ff"/>
<Option name="meter fill: 7" value="ff8000ff"/>
<Option name="meter fill: 8" value="ff0000ff"/>
<Option name="meter fill: 9" value="ff0000ff"/>
<Option name="meter background: bottom" value="333333ff"/>
<Option name="meter background: top" value="444444ff"/>
<Option name="midi meter fill: 0" value="008850ff"/>
<Option name="midi meter fill: 1" value="008850ff"/>
<Option name="midi meter fill: 2" value="00ff50ff"/>
<Option name="midi meter fill: 3" value="00ff50ff"/>
<Option name="midi meter fill: 4" value="fff050ff"/>
<Option name="midi meter fill: 5" value="fff050ff"/>
<Option name="midi meter fill: 6" value="ff8050ff"/>
<Option name="midi meter fill: 7" value="ff8050ff"/>
<Option name="midi meter fill: 8" value="ff0050ff"/>
<Option name="midi meter fill: 9" value="ff0050ff"/>
<Option name="meter marker" value="f2425bff"/>
<Option name="midi bus base" value="00000000"/>
<Option name="midi frame base" value="393d3766"/>

View File

@ -65,17 +65,28 @@ CANVAS_VARIABLE(canvasvar_MeasureLineBar, "measure line bar")
CANVAS_VARIABLE(canvasvar_MeasureLineBeat, "measure line beat")
CANVAS_VARIABLE(canvasvar_MeterBar, "meter bar")
CANVAS_VARIABLE(canvasvar_MeterBridgePeakLabel, "meterbridge peaklabel")
CANVAS_VARIABLE(canvasvar_MeterColorBase, "meter fill min")
CANVAS_VARIABLE(canvasvar_MeterColorClip, "meter fill clip")
CANVAS_VARIABLE(canvasvar_MeterColorMid, "meter fill mid")
CANVAS_VARIABLE(canvasvar_MeterColorTop, "meter fill max")
CANVAS_VARIABLE(canvasvar_MidiMeterColorBase, "midi meter fill min")
CANVAS_VARIABLE(canvasvar_MidiMeterColorClip, "midi meter fill clip")
CANVAS_VARIABLE(canvasvar_MidiMeterColorMid, "midi meter fill mid")
CANVAS_VARIABLE(canvasvar_MidiMeterColorTop, "midi meter fill max")
CANVAS_VARIABLE(canvasvar_MeterBackgroundBot, "meter background bottom")
CANVAS_VARIABLE(canvasvar_MeterBackgroundMid, "meter background mid")
CANVAS_VARIABLE(canvasvar_MeterBackgroundTop, "meter background top")
CANVAS_VARIABLE(canvasvar_MeterColor0, "meter fill: 0")
CANVAS_VARIABLE(canvasvar_MeterColor1, "meter fill: 1")
CANVAS_VARIABLE(canvasvar_MeterColor2, "meter fill: 2")
CANVAS_VARIABLE(canvasvar_MeterColor3, "meter fill: 3")
CANVAS_VARIABLE(canvasvar_MeterColor4, "meter fill: 4")
CANVAS_VARIABLE(canvasvar_MeterColor5, "meter fill: 5")
CANVAS_VARIABLE(canvasvar_MeterColor6, "meter fill: 6")
CANVAS_VARIABLE(canvasvar_MeterColor7, "meter fill: 7")
CANVAS_VARIABLE(canvasvar_MeterColor8, "meter fill: 8")
CANVAS_VARIABLE(canvasvar_MeterColor9, "meter fill: 9")
CANVAS_VARIABLE(canvasvar_MidiMeterColor0, "midi meter fill: 0")
CANVAS_VARIABLE(canvasvar_MidiMeterColor1, "midi meter fill: 1")
CANVAS_VARIABLE(canvasvar_MidiMeterColor2, "midi meter fill: 2")
CANVAS_VARIABLE(canvasvar_MidiMeterColor3, "midi meter fill: 3")
CANVAS_VARIABLE(canvasvar_MidiMeterColor4, "midi meter fill: 4")
CANVAS_VARIABLE(canvasvar_MidiMeterColor5, "midi meter fill: 5")
CANVAS_VARIABLE(canvasvar_MidiMeterColor6, "midi meter fill: 6")
CANVAS_VARIABLE(canvasvar_MidiMeterColor7, "midi meter fill: 7")
CANVAS_VARIABLE(canvasvar_MidiMeterColor8, "midi meter fill: 8")
CANVAS_VARIABLE(canvasvar_MidiMeterColor9, "midi meter fill: 9")
CANVAS_VARIABLE(canvasvar_MeterBackgroundBot, "meter background: bottom")
CANVAS_VARIABLE(canvasvar_MeterBackgroundTop, "meter background: top")
CANVAS_VARIABLE(canvasvar_MeterMarker, "meter marker")
CANVAS_VARIABLE(canvasvar_MidiBusBase, "midi bus base")
CANVAS_VARIABLE(canvasvar_MidiFrameBase, "midi frame base")

View File

@ -181,24 +181,43 @@ LevelMeter::setup_meters (int len, int initial_width, int thin_width)
//cerr << "LevelMeter::setup_meters() called color_changed = " << color_changed << " colors: " << endl;//DEBUG
for (int32_t n = nmeters-1; nmeters && n >= 0 ; --n) {
uint32_t b, m, t, c;
uint32_t c[10];
float stp[4] = {55.0, 77.5, 92.5, 100.0};
if (n < nmidi) {
b = ARDOUR_UI::config()->canvasvar_MidiMeterColorBase.get();
m = ARDOUR_UI::config()->canvasvar_MidiMeterColorMid.get();
t = ARDOUR_UI::config()->canvasvar_MidiMeterColorTop.get();
c = ARDOUR_UI::config()->canvasvar_MeterColorClip.get();
c[0] = ARDOUR_UI::config()->canvasvar_MidiMeterColor0.get();
c[1] = ARDOUR_UI::config()->canvasvar_MidiMeterColor1.get();
c[2] = ARDOUR_UI::config()->canvasvar_MidiMeterColor2.get();
c[3] = ARDOUR_UI::config()->canvasvar_MidiMeterColor3.get();
c[4] = ARDOUR_UI::config()->canvasvar_MidiMeterColor4.get();
c[5] = ARDOUR_UI::config()->canvasvar_MidiMeterColor5.get();
c[6] = ARDOUR_UI::config()->canvasvar_MidiMeterColor6.get();
c[7] = ARDOUR_UI::config()->canvasvar_MidiMeterColor7.get();
c[8] = ARDOUR_UI::config()->canvasvar_MidiMeterColor8.get();
c[9] = ARDOUR_UI::config()->canvasvar_MidiMeterColor9.get();
stp[0] = 115.0 * 32.0 / 128.0;
stp[1] = 115.0 * 64.0 / 128.0;
stp[2] = 115.0 * 100.0 / 128.0;
stp[3] = 115.0 * 112.0 / 128.0;
} else {
b = ARDOUR_UI::config()->canvasvar_MeterColorBase.get();
m = ARDOUR_UI::config()->canvasvar_MeterColorMid.get();
t = ARDOUR_UI::config()->canvasvar_MeterColorTop.get();
c = ARDOUR_UI::config()->canvasvar_MeterColorClip.get();
c[0] = ARDOUR_UI::config()->canvasvar_MeterColor0.get();
c[1] = ARDOUR_UI::config()->canvasvar_MeterColor1.get();
c[2] = ARDOUR_UI::config()->canvasvar_MeterColor2.get();
c[3] = ARDOUR_UI::config()->canvasvar_MeterColor3.get();
c[4] = ARDOUR_UI::config()->canvasvar_MeterColor4.get();
c[5] = ARDOUR_UI::config()->canvasvar_MeterColor5.get();
c[6] = ARDOUR_UI::config()->canvasvar_MeterColor6.get();
c[7] = ARDOUR_UI::config()->canvasvar_MeterColor7.get();
c[8] = ARDOUR_UI::config()->canvasvar_MeterColor8.get();
c[9] = ARDOUR_UI::config()->canvasvar_MeterColor9.get();
}
if (meters[n].width != width || meters[n].length != len || color_changed) {
delete meters[n].meter;
meters[n].meter = new FastMeter ((uint32_t) floor (Config->get_meter_hold()), width, FastMeter::Vertical, len,
b, b, m, m, t, t, c, c, c, c,
c[0], c[1], c[2], c[3], c[4],
c[5], c[6], c[7], c[8], c[9],
ARDOUR_UI::config()->canvasvar_MeterBackgroundBot.get(),
ARDOUR_UI::config()->canvasvar_MeterBackgroundTop.get()
ARDOUR_UI::config()->canvasvar_MeterBackgroundTop.get(),
stp[0], stp[1], stp[2], stp[3]
);
meters[n].width = width;
meters[n].length = len;

View File

@ -44,7 +44,10 @@ 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,
float stp0, float stp1,
float stp2, float stp3
)
{
orientation = o;
hold_cnt = hold;
@ -69,10 +72,10 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o, int len,
_bgc[0] = bgc0;
_bgc[1] = bgc1;
_stp[0] = 55.0; // log_meter(-18);
_stp[1] = 77.5; // log_meter(-9);
_stp[2] = 92.5; // log_meter(-3);
_stp[2] = 95.0; // log_meter(-2);
_stp[0] = stp0;
_stp[1] = stp1;
_stp[2] = stp2;
_stp[3] = stp3;
set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
@ -116,7 +119,7 @@ FastMeter::generate_meter_pattern (
cairo_pattern_add_color_stop_rgb (pat, 0.0,
r/255.0, g/255.0, b/255.0);
knee = (int)floor((float)height * 100.0f / 115.0f); // -0dB
knee = (int)floor((float)height * stp[3] / 115.0f); // -0dB
UINT_TO_RGBA (clr[8], &r, &g, &b, &a);
cairo_pattern_add_color_stop_rgb (pat, 1.0 - (knee/(double)height),
@ -198,7 +201,7 @@ FastMeter::request_vertical_meter(
height = max_pattern_metric_size;
const Pattern10MapKey key (width, height,
stp[0], stp[1], stp[2],
stp[0], stp[1], stp[2], stp[3],
clr[0], clr[1], clr[2], clr[3],
clr[4], clr[5], clr[6], clr[7],
clr[8], clr[9]);

View File

@ -39,10 +39,14 @@ class FastMeter : public Gtk::DrawingArea {
FastMeter (long hold_cnt, unsigned long width, Orientation, int len=0,
int clr0=0x008800ff, int clr1=0x008800ff,
int clr2=0x00ff00ff, int clr3=0x00ff00ff,
int clr4=0x80ff00ff, int clr5=0x80ff00ff,
int clr6=0xffaa00ff, int clr7=0xffaa00ff,
int clr4=0xffaa00ff, int clr5=0xffaa00ff,
int clr6=0xffff00ff, int clr7=0xffff00ff,
int clr8=0xff0000ff, int clr9=0xff0000ff,
int bgc0=0x333333ff, int bgc1=0x444444ff
int bgc0=0x333333ff, int bgc1=0x444444ff,
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);
float stp3 = 100.0
);
virtual ~FastMeter ();
@ -68,7 +72,7 @@ private:
gint pixheight;
gint pixwidth;
float _stp[3];
float _stp[4];
int _clr[10];
int _bgc[2];
@ -100,13 +104,13 @@ private:
struct Pattern10MapKey {
Pattern10MapKey (
int w, int h,
float stp0, float stp1, float stp2,
float stp0, float stp1, float stp2, float stp3,
int c0, int c1, int c2, int c3,
int c4, int c5, int c6, int c7,
int c8, int c9
)
: dim(w, h)
, stp(stp0, stp1, stp2)
, stp(stp0, stp1, stp2, stp3)
, cols(c0, c1, c2, c3, c4, c5, c6, c7, c8, c9)
{}
inline bool operator<(const Pattern10MapKey& rhs) const {
@ -115,7 +119,7 @@ private:
|| (dim == rhs.dim && stp == rhs.stp && cols < rhs.cols);
}
boost::tuple<int, int> dim;
boost::tuple<float, float, float> stp;
boost::tuple<float, float, float, float> stp;
boost::tuple<int, int, int, int, int, int, int, int, int, int> cols;
};
typedef std::map<Pattern10MapKey, Cairo::RefPtr<Cairo::Pattern> > Pattern10Map;