summaryrefslogtreecommitdiff
path: root/gtk2_ardour/export_report.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-02-10 21:45:34 +0100
committerRobin Gareus <robin@gareus.org>2016-02-10 22:35:01 +0100
commit2b42dc13fd60739727199f4dc9ed61e1a4a97912 (patch)
treed55ba3e055a305475e7ce63ba3ba8393fb97279a /gtk2_ardour/export_report.cc
parentee3125318727976894d7a3d434e5e43d2c90a066 (diff)
exported waveform annotation
Diffstat (limited to 'gtk2_ardour/export_report.cc')
-rw-r--r--gtk2_ardour/export_report.cc55
1 files changed, 51 insertions, 4 deletions
diff --git a/gtk2_ardour/export_report.cc b/gtk2_ardour/export_report.cc
index b99c457810..e0e80fbf02 100644
--- a/gtk2_ardour/export_report.cc
+++ b/gtk2_ardour/export_report.cc
@@ -20,6 +20,7 @@
#include <gtkmm/label.h>
#include <gtkmm/stock.h>
+#include "gtkmm2ext/utils.h"
#include "canvas/utils.h"
#include "canvas/colors.h"
@@ -38,6 +39,10 @@ ExportReport::ExportReport (StatusPtr s)
AnalysisResults & ar = status->result_map;
+ std::vector<double> dashes;
+ dashes.push_back (3.0);
+ dashes.push_back (5.0);
+
for (AnalysisResults::iterator i = ar.begin (); i != ar.end (); ++i) {
Label *l;
VBox *vb = manage (new VBox ());
@@ -131,10 +136,6 @@ ExportReport::ExportReport (StatusPtr s)
cr->set_source_rgba (.9, .9, .9, 1.0);
layout->show_in_cairo_context (cr);
- std::vector<double> dashes;
- dashes.push_back (3.0);
- dashes.push_back (5.0);
-
for (int g = -53; g <= -8; g += 5) {
// grid-lines. [110] -59LUFS .. [650]: -5 LUFS
layout->set_text (string_compose ("%1", g));
@@ -197,11 +198,57 @@ ExportReport::ExportReport (StatusPtr s)
}
cr->stroke ();
+ // zero line
cr->set_source_rgba (.3, .3, .3, 0.7);
cr->move_to (0, height_2 - .5);
cr->line_to (peaks, height_2 - .5);
cr->stroke ();
+ cr->set_dash (dashes, 2.0);
+ cr->set_line_cap (Cairo::LINE_CAP_ROUND);
+
+ Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (get_pango_context ());
+ layout->set_alignment (Pango::ALIGN_LEFT);
+ layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
+ int w, h;
+
+ layout->set_text (_("dBFS"));
+ layout->get_pixel_size (w, h);
+ Gtkmm2ext::rounded_rectangle (cr,
+ 5, rint (height_2 - w * .5 - 1), h + 2, w + 2, 4);
+ cr->set_source_rgba (.1, .1, .1, 0.5);
+ cr->fill ();
+ cr->move_to (6, rint (height_2 + w * .5));
+ cr->set_source_rgba (.9, .9, .9, 1.0);
+ cr->save ();
+ cr->rotate (M_PI / -2.0);
+ layout->show_in_cairo_context (cr);
+ cr->restore ();
+
+#define PEAKANNOTATION(POS, TXT) { \
+ const float yy = rint (POS); \
+ layout->set_text (TXT); \
+ layout->get_pixel_size (w, h); \
+ cr->set_operator (Cairo::OPERATOR_OVER); \
+ Gtkmm2ext::rounded_rectangle (cr, \
+ 5, rint ((POS) - h * .5 - 1), w + 2, h + 2, 4); \
+ cr->set_source_rgba (.1, .1, .1, 0.5); \
+ cr->fill (); \
+ cr->move_to (6, rint ((POS) - h * .5)); \
+ cr->set_source_rgba (.9, .9, .9, 1.0); \
+ layout->show_in_cairo_context (cr); \
+ cr->move_to (8 + w, yy - .5); \
+ cr->line_to (peaks, yy - .5); \
+ cr->set_source_rgba (.3, .3, .3, 1.0); \
+ cr->set_operator (Cairo::OPERATOR_ADD); \
+ cr->stroke (); \
+ }
+
+ PEAKANNOTATION (height_2 * 0.5, _("-6"));
+ PEAKANNOTATION (height_2 * 1.5, _("-6"));
+ PEAKANNOTATION (height_2 * 0.2921, _("-3"));
+ PEAKANNOTATION (height_2 * 1.7079, _("-3"));
+
wave->flush ();
CimgArea *wv = manage (new CimgArea (wave));
vb->pack_start (*wv);