2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include <pangomm/layout.h>
22 #include <gtkmm/label.h>
23 #include <gtkmm/table.h>
24 #include <gtkmm/stock.h>
26 #include "pbd/openuri.h"
27 #include "pbd/basename.h"
28 #include "gtkmm2ext/utils.h"
29 #include "gtkmm2ext/utils.h"
30 #include "canvas/utils.h"
31 #include "canvas/colors.h"
33 #include "audiographer/general/analyser.h"
35 #include "ardour/audiofilesource.h"
36 #include "ardour/audioregion.h"
37 #include "ardour/auditioner.h"
38 #include "ardour/dB.h"
39 #include "ardour/logmeter.h"
40 #include "ardour/region_factory.h"
41 #include "ardour/session.h"
42 #include "ardour/smf_source.h"
43 #include "ardour/source_factory.h"
44 #include "ardour/srcfilesource.h"
45 #include "ardour/utils.h"
47 #include "audio_clock.h"
48 #include "export_report.h"
49 #include "ui_config.h"
54 using namespace ARDOUR;
56 ExportReport::ExportReport (Session* session, StatusPtr s)
57 : ArdourDialog (_("Export Report/Analysis"))
64 init (s->result_map, true);
67 ExportReport::ExportReport (const std::string & title, const AnalysisResults & ar)
68 : ArdourDialog (title)
79 ExportReport::init (const AnalysisResults & ar, bool with_file)
81 set_resizable (false);
82 pages.set_scrollable ();
84 std::vector<double> dashes;
85 dashes.push_back (3.0);
86 dashes.push_back (5.0);
89 for (AnalysisResults::const_iterator i = ar.begin (); i != ar.end (); ++i, ++page) {
91 VBox *vb = manage (new VBox ());
92 Table *t = manage (new Table (4, 4));
93 Table *wtbl = manage (new Table (3, 2));
95 t->set_border_width (0);
97 wtbl->set_spacings (4);
99 vb->set_border_width (4);
100 vb->pack_start (*t, false, false, 2);
101 vb->pack_start (*wtbl, false, false, 2);
103 std::string path = i->first;
104 ExportAnalysisPtr p = i->second;
106 std::list<CimgPlayheadArea*> playhead_widgets;
109 l = manage (new Label (_("File:"), ALIGN_END));
110 t->attach (*l, 0, 1, 0, 1);
111 l = manage (new Label ());
112 l->set_ellipsize (Pango::ELLIPSIZE_START);
113 l->set_width_chars (48);
114 l->set_max_width_chars (48);
116 l->set_alignment (ALIGN_START, ALIGN_CENTER);
117 t->attach (*l, 1, 3, 0, 1, FILL, SHRINK);
119 Button *b = manage (new Button (_("Open Folder")));
120 t->attach (*b, 3, 4, 0, 2, FILL, SHRINK);
121 b->signal_clicked ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::open_folder), path));
127 framecnt_t file_length = 0;
128 framecnt_t sample_rate = 0;
129 framecnt_t start_off = 0;
130 unsigned int channels = 0;
131 std::string file_fmt;
133 if (with_file && AudioFileSource::get_soundfile_info (path, info, errmsg)) {
136 file_length = info.length;
137 sample_rate = info.samplerate;
138 start_off = info.timecode;
139 channels = info.channels;
141 files.insert (std::make_pair (page, AuditionInfo (path, channels)));
143 /* File Info Table */
145 framecnt_t const nfr = _session ? _session->nominal_frame_rate () : 25;
146 double src_coef = (double) nfr / info.samplerate;
148 l = manage (new Label (_("Format:"), ALIGN_END));
149 t->attach (*l, 0, 1, 1, 2);
150 file_fmt = info.format_name;
151 std::replace (file_fmt.begin (), file_fmt.end (), '\n', ' ');
152 l = manage (new Label ());
153 l->set_ellipsize (Pango::ELLIPSIZE_START);
154 l->set_width_chars (48);
155 l->set_max_width_chars (48);
156 l->set_text (file_fmt);
157 l->set_alignment (ALIGN_START, ALIGN_CENTER);
158 t->attach (*l, 1, 3, 1, 2, FILL, SHRINK);
160 l = manage (new Label (_("Channels:"), ALIGN_END));
161 t->attach (*l, 0, 1, 2, 3);
162 l = manage (new Label (string_compose ("%1", info.channels), ALIGN_START));
163 t->attach (*l, 1, 2, 2, 3);
165 l = manage (new Label (_("Sample rate:"), ALIGN_END));
166 t->attach (*l, 0, 1, 3, 4);
167 l = manage (new Label (string_compose (_("%1 Hz"), info.samplerate), ALIGN_START));
168 t->attach (*l, 1, 2, 3, 4);
170 l = manage (new Label (_("Duration:"), ALIGN_END));
171 t->attach (*l, 2, 3, 2, 3);
172 clock = manage (new AudioClock ("sfboxLengthClock", true, "", false, false, true, false));
173 clock->set_session (_session);
174 clock->set_mode (AudioClock::MinSec);
175 clock->set (info.length * src_coef + 0.5, true);
176 t->attach (*clock, 3, 4, 2, 3);
178 l = manage (new Label (_("Timecode:"), ALIGN_END));
179 t->attach (*l, 2, 3, 3, 4);
180 clock = manage (new AudioClock ("sfboxTimecodeClock", true, "", false, false, false, false));
181 clock->set_session (_session);
182 clock->set_mode (AudioClock::Timecode);
183 clock->set (info.timecode * src_coef + 0.5, true);
184 t->attach (*clock, 3, 4, 3, 4);
185 } else if (with_file) {
186 l = manage (new Label (_("Error:"), ALIGN_END));
187 t->attach (*l, 0, 1, 1, 2);
188 l = manage (new Label (errmsg, ALIGN_START));
189 t->attach (*l, 1, 4, 1, 2);
193 Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (get_pango_context ());
195 // calc geometry of numerics
196 const float dbfs = accurate_coefficient_to_dB (p->peak);
197 const float dbtp = accurate_coefficient_to_dB (p->truepeak);
199 #define TXTSIZE(LINE, TXT, FONT) { \
200 layout->set_font_description (UIConfiguration::instance ().FONT ()); \
201 layout->set_text (TXT); \
202 layout->get_pixel_size (w, h); \
203 if (w > mnw) { mnw = w; } \
204 if (h > lin[LINE]) { lin[LINE] = h; } \
207 #define TXTWIDTH(TXT, FONT) { \
208 layout->set_font_description (UIConfiguration::instance ().FONT ()); \
209 layout->set_text (TXT); \
210 layout->get_pixel_size (w, h); \
211 if (w > mml) { mml = w; } \
214 int m_r = 0; // right side
215 int mnh = 0; // mono height
216 int mnw = 0; // max numeric width
217 int anw = 0; // spectrum annotation text width
219 int lin[6] = { 0, 0, 0, 0, 0, 0 }; // max line height
221 TXTSIZE(0, _("(too short integration time)"), get_SmallFont);
223 TXTSIZE(0, _("-888"), get_SmallMonospaceFont);
228 TXTSIZE(0, _("Peak:"), get_SmallFont);
229 TXTSIZE(1, string_compose (_("%1 dBFS"), std::setprecision (1), std::fixed, dbfs), get_LargeFont);
230 TXTSIZE(2, _("True Peak:"), get_SmallFont);
231 TXTSIZE(3, string_compose (_("%1 dBTP"), std::setprecision (1), std::fixed, dbtp), get_LargeFont);
232 TXTSIZE(4, _("Normalization Gain:"), get_SmallFont);
233 TXTSIZE(5, _("+888.88 dB"), get_SmallMonospaceFont);
235 TXTSIZE(0, _("Integrated Loudness:"), get_SmallFont);
236 TXTSIZE(1, string_compose (_("%1 LUFS"), std::setprecision (1), std::fixed, p->loudness), get_LargeFont);
237 TXTSIZE(2, _("Loudness Range:"), get_SmallFont);
238 TXTSIZE(3, string_compose (_("%1 LU"), std::setprecision (1), std::fixed, p->loudness_range), get_LargeFont);
241 const int ht = lin[0] * 1.25 + lin[1] * 1.25 + lin[2] * 1.25 + lin[3] *1.25 + lin[4] * 1.25 + lin[5];
242 const int hh = std::max (100, ht + 12);
243 const int htn = lin[0] * 1.25 + lin[1] * 1.25 + lin[2] * 1.25 + lin[3];
244 int m_l = 2 * mnw + /*hist-width*/ 540 + /*box spacing*/ 8 - /*peak-width*/ 800 - m_r; // margin left
246 int mml = 0; // min margin left -- ensure left margin is wide enough
247 TXTWIDTH (_("Time"), get_SmallFont);
248 TXTWIDTH (_("100"), get_SmallMonospaceFont);
249 m_l = (std::max(anw + mnh + 14, std::max (m_l, mml + 8)) + 3) & ~3;
251 mnw = (m_l - /*hist-width*/ 540 - /*box spacing*/ 8 + /*peak-width*/ 800 + m_r) / 2;
252 const int nw2 = mnw / 2; // nums, horizontal center
256 y0[0] = (hh - ht) * .5;
258 y0[0] = (hh - htn) * .5;
260 y0[1] = y0[0] + lin[0] * 1.25;
261 y0[2] = y0[1] + lin[1] * 1.25;
262 y0[3] = y0[2] + lin[2] * 1.25;
263 y0[4] = y0[3] + lin[3] * 1.25;
264 y0[5] = y0[4] + lin[4] * 1.25;
266 /* calc heights & alignment of png-image */
267 const float specth = sizeof (p->spectrum[0]) / sizeof (float);
268 const float waveh2 = std::min (100, 8 * lin[0] / (int) p->n_channels);
270 Cairo::RefPtr<Cairo::ImageSurface> png_surface;
274 if (with_file && UIConfiguration::instance().get_save_export_analysis_image ()) { /*png image */
275 const int top_w = 540 + 2 * (mnw + 4); // 4px spacing
276 const int wav_w = m_l + m_r + 4 + sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
277 const int spc_w = m_l + m_r + 4 + sizeof (p->spectrum) / sizeof (float) / specth;
281 if (channels > 0 && file_length > 0 && sample_rate > 0) {
282 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
283 layout->set_text (_("00:00:00.000"));
284 layout->get_pixel_size (w, h);
285 int height = h * 1.75;
286 ann_h = 4 + height /* Time Axis */;
288 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
289 layout->set_text (_("0|A8"));
290 layout->get_pixel_size (w, h);
292 ann_h += 4 + 3 * linesp; /* File Info */;
295 const int png_h = hh + 4 + p->n_channels * (2 * waveh2 + 4) + ann_h + specth + 4;
296 png_w = std::max (std::max (top_w, wav_w), spc_w);
298 png_surface = Cairo::ImageSurface::create (Cairo::FORMAT_RGB24, png_w, png_h);
299 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
300 pcx->set_source_rgb (.2, .2, .2);
303 if (channels > 0 && file_length > 0 && sample_rate > 0) {
305 // Add file-name, format, duration, sample-rate & timecode
306 pcx->set_source_rgb (.7, .7, .7);
307 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
308 layout->set_alignment (Pango::ALIGN_LEFT);
310 #define IMGLABEL(X0, STR, VAL) { \
311 layout->set_text (STR); \
312 pcx->move_to (X0, png_y0); \
313 layout->get_pixel_size (w, h); \
314 layout->show_in_cairo_context (pcx); \
315 layout->set_text (VAL); \
316 pcx->move_to (X0 + w + 2, png_y0); \
317 layout->show_in_cairo_context (pcx); \
320 // TODO get max width of labels per column, right-align labels, x-align 1/3, 2/3 columns
322 const int lx1 = m_l + png_w * 2 / 3; // right-col is short (channels, SR, duration)
323 std::string sha1sum = ARDOUR::compute_sha1_of_file (path);
324 if (!sha1sum.empty()) {
325 sha1sum = " (sha1: " + sha1sum + ")";
328 IMGLABEL (lx0, _("File:"), Glib::path_get_basename (path) + sha1sum);
329 IMGLABEL (lx1, _("Channels:"), string_compose ("%1", channels));
332 IMGLABEL (lx0, _("Format:"), file_fmt);
333 IMGLABEL (lx1, _("Sample rate:"), string_compose (_("%1 Hz"), sample_rate));
338 _session->sample_to_timecode (start_off, tct, false, false);
339 IMGLABEL (lx0, _("Timecode:"), Timecode::timecode_format_time (tct));
341 IMGLABEL (lx1, _("Duration:"), Timecode::timecode_format_sampletime (file_length, sample_rate, 1000, false));
346 { /* peak, loudness and R128 histogram */
347 Cairo::RefPtr<Cairo::ImageSurface> nums = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, mnw, hh);
348 Cairo::RefPtr<Cairo::ImageSurface> ebur = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, mnw, hh);
349 Cairo::RefPtr<Cairo::ImageSurface> hist = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, 540, hh);
351 /* peak and true-peak numerics */
352 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (nums);
353 cr->set_source_rgba (0, 0, 0, 1.0);
356 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
357 layout->set_alignment (Pango::ALIGN_LEFT);
358 layout->set_text (_("Peak:"));
359 layout->get_pixel_size (w, h);
360 cr->move_to (rint (nw2 - w * .5), y0[0]);
361 cr->set_source_rgba (.7, .7, .7, 1.0);
362 layout->show_in_cairo_context (cr);
364 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
365 layout->set_text (string_compose (_("%1 dBFS"), std::setprecision (1), std::fixed, dbfs));
366 layout->get_pixel_size (w, h);
367 cr->move_to (rint (nw2 - w * .5), y0[1]);
368 if (dbfs >= 0.f) { cr->set_source_rgba (1.0, .1, .1, 1.0); }
369 else if (dbfs > -1.f) { cr->set_source_rgba (1.0, .7, .0, 1.0); }
370 layout->show_in_cairo_context (cr);
373 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
374 layout->set_text (_("True Peak:"));
375 layout->get_pixel_size (w, h);
376 cr->move_to (rint (nw2 - w * .5), y0[2]);
377 cr->set_source_rgba (.7, .7, .7, 1.0);
378 layout->show_in_cairo_context (cr);
380 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
381 layout->set_text (string_compose (_("%1 dBTP"), std::setprecision (1), std::fixed, dbtp));
382 layout->get_pixel_size (w, h);
383 cr->move_to (rint (nw2 - w * .5), y0[3]);
384 if (dbtp >= 0.f) { cr->set_source_rgba (1.0, .1, .1, 1.0); }
385 else if (dbtp > -1.f) { cr->set_source_rgba (1.0, .7, .0, 1.0); }
386 layout->show_in_cairo_context (cr);
390 const float ndb = accurate_coefficient_to_dB (p->norm_gain_factor);
391 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
392 layout->set_text (_("Normalization Gain:"));
393 layout->get_pixel_size (w, h);
394 cr->move_to (rint (nw2 - w * .5), y0[4]);
395 cr->set_source_rgba (.7, .7, .7, 1.0);
396 layout->show_in_cairo_context (cr);
398 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
399 layout->set_text (string_compose (_("%1 dB"), std::setprecision (2), std::showpos, std::fixed, ndb));
401 layout->get_pixel_size (w, h);
402 cr->move_to (rint (nw2 - w * .5), y0[5]);
403 // TODO tweak thresholds
404 if (p->norm_gain_factor < 1.0) {
405 cr->set_source_rgba (1.0, .7, .1, 1.0);
406 } else if (p->norm_gain_factor == 1.0) {
407 cr->set_source_rgba (.7, .7, .7, 1.0);
408 } else if (fabsf (ndb) < 12) {
409 cr->set_source_rgba (.1, 1.0, .1, 1.0);
410 } else if (fabsf (ndb) < 18) {
411 cr->set_source_rgba (1.0, .7, .1, 1.0);
413 cr->set_source_rgba (1.0, .1, .1, 1.0);
415 layout->show_in_cairo_context (cr);
420 /* EBU R128 numerics */
421 cr = Cairo::Context::create (ebur);
422 cr->set_source_rgba (0, 0, 0, 1.0);
425 cr->set_source_rgba (.7, .7, .7, 1.0);
427 if (!i->second->have_loudness) {
428 layout->set_alignment (Pango::ALIGN_CENTER);
429 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
430 layout->set_text (_("Not\nAvailable"));
431 layout->get_pixel_size (w, h);
432 cr->move_to (rint (nw2 - w * .5), rint ((hh - h) * .5));
433 layout->show_in_cairo_context (cr);
435 else if (p->loudness == -200 && p->loudness_range == 0) {
436 layout->set_alignment (Pango::ALIGN_CENTER);
437 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
438 layout->set_text (_("Not\nAvailable"));
439 layout->get_pixel_size (w, h);
440 cr->move_to (rint (nw2 - w * .5), rint (hh * .5 - h * .66));
441 layout->show_in_cairo_context (cr);
444 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
445 layout->set_text (_("(too short integration time)"));
446 layout->get_pixel_size (w, h);
447 cr->move_to (rint (nw2 - w * .5), rint (hh * .5 + yy));
448 layout->show_in_cairo_context (cr);
451 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
452 layout->set_alignment (Pango::ALIGN_LEFT);
453 layout->set_text (_("Integrated Loudness:"));
454 layout->get_pixel_size (w, h);
455 cr->move_to (rint (nw2 - w * .5), y0[0]);
456 layout->show_in_cairo_context (cr);
458 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
459 layout->set_text (string_compose (_("%1 LUFS"), std::setprecision (1), std::fixed, p->loudness));
460 layout->get_pixel_size (w, h);
461 cr->move_to (rint (nw2 - w * .5), y0[1]);
462 layout->show_in_cairo_context (cr);
464 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
465 layout->set_text (_("Loudness Range:"));
466 layout->get_pixel_size (w, h);
467 cr->move_to (rint (nw2 - w * .5), y0[2]);
468 layout->show_in_cairo_context (cr);
470 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
471 layout->set_text (string_compose (_("%1 LU"), std::setprecision (1), std::fixed, p->loudness_range));
472 layout->get_pixel_size (w, h);
473 cr->move_to (rint (nw2 - w * .5), y0[3]);
474 layout->show_in_cairo_context (cr);
478 /* draw loudness histogram */
479 cr = Cairo::Context::create (hist);
480 cr->set_source_rgba (0, 0, 0, 1.0);
483 cr->set_source_rgba (.7, .7, .7, 1.0);
484 cr->set_line_width (1.0);
486 if (p->loudness_hist_max > 0 && i->second->have_loudness) {
488 for (size_t x = 0 ; x < 510; ++x) {
489 cr->move_to (x - .5, hh);
490 cr->line_to (x - .5, (float) hh * (1.0 - p->loudness_hist[x] / (float) p->loudness_hist_max));
494 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
495 layout->set_alignment (Pango::ALIGN_CENTER);
498 layout->set_text (_("LUFS\n(short)"));
499 layout->get_pixel_size (w, h);
500 Gtkmm2ext::rounded_rectangle (cr, 5, 5, w + 2, h + 2, 4);
501 cr->set_source_rgba (.1, .1, .1, 0.7);
504 cr->set_source_rgba (.9, .9, .9, 1.0);
505 layout->show_in_cairo_context (cr);
508 layout->set_text (_("Multiplicity"));
509 layout->get_pixel_size (w, h);
510 Gtkmm2ext::rounded_rectangle (cr, 5, hh - w - 3, h + 2, w + 2, 4);
511 cr->set_source_rgba (.1, .1, .1, 0.7);
514 cr->move_to (6, hh - 2);
515 cr->set_source_rgba (.9, .9, .9, 1.0);
516 cr->rotate (M_PI / -2.0);
517 layout->show_in_cairo_context (cr);
521 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
522 layout->set_alignment (Pango::ALIGN_LEFT);
523 for (int g = -53; g <= -8; g += 5) {
524 // grid-lines. [110] -59LUFS .. [650]: -5 LUFS
525 layout->set_text (string_compose ("%1", std::setw(3), std::setfill(' '), g));
526 layout->get_pixel_size (w, h);
528 cr->set_operator (Cairo::OPERATOR_OVER);
529 Gtkmm2ext::rounded_rectangle (cr,
530 rint ((g + 59.0) * 10.0 - h * .5), 5,
532 const float pk = (g + 59.0) / 54.0;
533 ArdourCanvas::Color c = ArdourCanvas::hsva_to_color (252 - 260 * pk, .9, .3 + pk * .4, .6);
534 ArdourCanvas::set_source_rgba (cr, c);
538 cr->set_source_rgba (.9, .9, .9, 1.0);
539 cr->move_to (rint ((g + 59.0) * 10.0 - h * .5), w + 6.0);
540 cr->rotate (M_PI / -2.0);
541 layout->show_in_cairo_context (cr);
544 cr->set_operator (Cairo::OPERATOR_ADD);
546 cr->set_source_rgba (.3, .3, .3, 1.0);
547 cr->set_dash (dashes, 1.0);
548 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
549 cr->move_to (rint ((g + 59.0) * 10.0) + .5, w + 8.0);
550 cr->line_to (rint ((g + 59.0) * 10.0) + .5, hh);
556 layout->set_alignment (Pango::ALIGN_CENTER);
557 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
558 layout->set_text (_("Not\nAvailable"));
559 layout->get_pixel_size (w, h);
560 cr->move_to (rint ((510 - w) * .5), rint ((hh - h) * .5));
561 layout->show_in_cairo_context (cr);
567 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
568 pcx->set_source (nums, 0, png_y0);
570 pcx->set_source (hist, (png_w - 540) / 2, png_y0);
572 pcx->set_source (ebur, png_w - mnw, png_y0);
577 CimgArea *nu = manage (new CimgArea (nums));
578 CimgArea *eb = manage (new CimgArea (ebur));
579 CimgArea *hi = manage (new CimgArea (hist));
580 HBox *hb = manage (new HBox ());
582 hb->pack_start (*nu, false, false);
583 hb->pack_start (*hi, false, false);
584 hb->pack_start (*eb, false, false);
586 wtbl->attach (*hb, 0, 2, wrow, wrow + 1, SHRINK, SHRINK);
590 #define XAXISLABEL(POS, TXT) { \
591 const float yy = rint (POS); \
592 layout->set_text (TXT); \
593 layout->get_pixel_size (w, h); \
594 cr->move_to (m_l - 8 - w, rint ((POS) - h * .5)); \
595 cr->set_source_rgba (.9, .9, .9, 1.0); \
596 cr->set_operator (Cairo::OPERATOR_OVER); \
597 layout->show_in_cairo_context (cr); \
598 cr->move_to (m_l - 4, yy - .5); \
599 cr->line_to (m_l + width, yy - .5); \
600 cr->set_source_rgba (.3, .3, .3, 1.0); \
601 cr->set_operator (Cairo::OPERATOR_ADD); \
607 VBox *lrb = manage (new VBox());
608 ToggleButton *log = manage (new ToggleButton (S_("Logscale|Lg")));
609 ToggleButton *rec = manage (new ToggleButton (S_("Rectified|Rf")));
610 Gtkmm2ext::UI::instance()->set_tip (log, _("Logscale"));
611 Gtkmm2ext::UI::instance()->set_tip (rec, _("Rectified"));
613 lrb->pack_start (*log, false, false, 5);
614 lrb->pack_end (*rec, false, false, 5);
615 log->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_logscale_toggled), log));
616 rec->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_rectivied_toggled), rec));
618 wtbl->attach (*lrb, 1, 2, wrow, wrow + p->n_channels, SHRINK, SHRINK);
621 for (uint32_t c = 0; c < p->n_channels; ++c) {
623 const size_t width = sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
625 Cairo::RefPtr<Cairo::ImageSurface> wave;
626 Cairo::RefPtr<Cairo::ImageSurface> wave_log;
627 Cairo::RefPtr<Cairo::ImageSurface> wave_rect;
628 Cairo::RefPtr<Cairo::ImageSurface> wave_lr;
629 draw_waveform(wave, p, c, m_l, width, anw, waveh2, false, false);
630 draw_waveform(wave_log, p, c, m_l, width, anw, waveh2, true, false);
631 draw_waveform(wave_rect, p, c, m_l, width, anw, waveh2, false, true);
632 draw_waveform(wave_lr, p, c, m_l, width, anw, waveh2, true, true);
634 CimgWaveArea *wv = manage (new CimgWaveArea (wave, wave_log, wave_rect, wave_lr, m_l, width));
636 playhead_widgets.push_back (wv);
637 waves.push_back (wv);
638 wv->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
639 wtbl->attach (*wv, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
643 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
644 pcx->set_source (wave, 0, png_y0);
646 png_y0 += 2 * waveh2 + 4;
650 if (channels > 0 && file_length > 0 && sample_rate > 0)
652 /* Time Axis -- re-use waveform width */
653 const size_t width = sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
654 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
655 layout->set_text (_("00:00:00.000"));
656 layout->get_pixel_size (w, h);
657 int height = h * 1.75;
658 Cairo::RefPtr<Cairo::ImageSurface> ytme = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, height);
659 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (ytme);
660 cr->set_operator (Cairo::OPERATOR_SOURCE);
661 cr->set_source_rgba (0, 0, 0, 1.0);
663 cr->rectangle (0, 0, m_l, height);
664 cr->set_source_rgba (0, 0, 0, 0);
666 cr->set_operator (Cairo::OPERATOR_OVER);
668 cr->set_line_width (1.0);
669 for (int i = 0; i <= 4; ++i) {
670 const float fract = (float) i / 4.0;
671 // " XX:XX:XX.XXX" [space/minus] 12 chars = 13.
672 const float xalign = (i == 4) ? 1.0 : (i == 0) ? 1.0 / 13.0 : 7.0 / 13.0;
675 AudioClock::print_minsec (start_off + file_length * fract,
676 buf, sizeof (buf), sample_rate);
678 layout->set_text (buf);
679 layout->get_pixel_size (w, h);
680 cr->move_to (rint (m_l + width * fract - w * xalign), rint (.5 * (height - h)));
681 cr->set_source_rgba (.9, .9, .9, 1.0);
682 layout->show_in_cairo_context (cr);
684 cr->set_source_rgba (.7, .7, .7, 1.0);
685 cr->move_to (rint (m_l + width * fract) - .5, 0);
686 cr->line_to (rint (m_l + width * fract) - .5, ceil (height * .15));
687 cr->move_to (rint (m_l + width * fract) - .5, floor (height * .85));
688 cr->line_to (rint (m_l + width * fract) - .5, height);
692 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
693 layout->set_text (_("Time"));
694 cr->set_source_rgba (.9, .9, .9, 1.0);
695 layout->get_pixel_size (w, h);
696 cr->move_to (rint (m_l - w - 8), rint (.5 * (height - h)));
697 layout->show_in_cairo_context (cr);
700 CimgPlayheadArea *tm = manage (new CimgPlayheadArea (ytme, m_l, width, true));
701 playhead_widgets.push_back (tm);
702 tm->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
703 wtbl->attach (*tm, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
707 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
708 pcx->set_source (ytme, 0, png_y0);
710 png_y0 += height + 4;
716 const size_t height = specth;
717 const size_t swh = sizeof (p->spectrum) / sizeof (float);
718 const size_t width = swh / height;
720 Cairo::RefPtr<Cairo::ImageSurface> spec = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, height);
721 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (spec);
722 cr->set_operator (Cairo::OPERATOR_SOURCE);
723 cr->rectangle (0, 0, m_l, height);
724 cr->set_source_rgba (0, 0, 0, 0);
726 cr->rectangle (m_l, 0, width, height);
727 cr->set_source_rgba (0, 0, 0, 1.0);
729 cr->set_operator (Cairo::OPERATOR_OVER);
731 for (size_t x = 0 ; x < width; ++x) {
732 for (size_t y = 0 ; y < height; ++y) {
733 const float pk = p->spectrum[x][y];
734 ArdourCanvas::Color c = ArdourCanvas::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
735 ArdourCanvas::set_source_rgba (cr, c);
736 cr->rectangle (m_l + x - .5, y - .5, 1, 1);
742 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
743 layout->set_text (_("Hz"));
744 layout->get_pixel_size (w, h);
745 cr->move_to (rint (m_l - h - anw - 10), rint ((height + w) * .5));
746 cr->set_source_rgba (.9, .9, .9, 1.0);
748 cr->rotate (M_PI / -2.0);
749 layout->show_in_cairo_context (cr);
753 cr->set_line_width (1.0);
754 cr->set_dash (dashes, 2.0);
755 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
757 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
758 //XAXISLABEL (p->freq[0], _("50Hz"));
759 XAXISLABEL (p->freq[1], _("100"));
760 XAXISLABEL (p->freq[2], _("500"));
761 XAXISLABEL (p->freq[3], _("1K"));
762 XAXISLABEL (p->freq[4], _("5K"));
763 XAXISLABEL (p->freq[5], _("10K"));
767 Cairo::RefPtr<Cairo::ImageSurface> scale = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_r, height);
768 cr = Cairo::Context::create (scale);
769 cr->set_operator (Cairo::OPERATOR_SOURCE);
770 cr->rectangle (0, 0, m_r, height);
771 cr->set_source_rgba (0, 0, 0, 0);
774 cr->set_operator (Cairo::OPERATOR_OVER);
775 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
776 layout->set_alignment (Pango::ALIGN_LEFT);
777 layout->set_text (_("dBFS"));
778 layout->get_pixel_size (w, h);
779 cr->move_to (rint (.5 * (m_r - w)), height - h - 2);
780 cr->set_source_rgba (.9, .9, .9, 1.0);
781 layout->show_in_cairo_context (cr);
783 int innertop = ceil (mnh * .5) + 1;
784 size_t innerheight = (height - 2 * innertop - h - 2);
786 cr->rectangle (1, innertop - 1, m_r - 2 - anw, innerheight + 2);
787 cr->set_source_rgba (0, 0, 0, 1.0);
788 cr->fill_preserve ();
789 cr->set_line_width (1.0);
790 cr->set_source_rgba (.7, .7, .6, 1.0);
793 for (size_t y = 0 ; y < innerheight - 2; ++y) {
794 const float pk = 1.0 - (float) y / innerheight;
795 ArdourCanvas::Color c = ArdourCanvas::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
796 ArdourCanvas::set_source_rgba (cr, c);
797 cr->rectangle (2, innertop + y + .5, m_r - 4 - anw, 1);
801 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
802 for (int i = 0; i <= 4; ++i) {
803 const float fract = (float) i / 4.0;
804 const float yalign = .5; // (i == 4) ? 0 : (i == 0) ? 1.0 : .5;
806 snprintf (buf, sizeof (buf), "%.0f", AudioGrapher::Analyser::fft_range_db * -fract);
807 layout->set_text (buf);
808 layout->get_pixel_size (w, h);
810 cr->move_to (m_r - anw, rint (innertop + fract * innerheight - h * yalign));
811 cr->set_source_rgba (.9, .9, .9, 1.0);
812 layout->show_in_cairo_context (cr);
816 CimgPlayheadArea *sp = manage (new CimgPlayheadArea (spec, m_l, width));
817 playhead_widgets.push_back (sp);
818 sp->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
819 CimgArea *an = manage (new CimgArea (scale));
820 wtbl->attach (*sp, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
821 wtbl->attach (*an, 1, 2, wrow, wrow + 1, SHRINK, SHRINK);
825 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
826 pcx->set_source (spec, 0, png_y0);
828 pcx->set_source (scale, png_w - m_r, png_y0);
833 timeline[page] = playhead_widgets;
835 HBox *tab = manage (new HBox ());
836 l = manage (new Label (Glib::path_get_basename (path)));
837 Gtk::Image *img = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_MENU));
838 tab->pack_start (*img);
839 tab->pack_start (*l);
843 pages.pages ().push_back (Notebook_Helpers::TabElem (*vb, *tab));
844 pages.signal_switch_page().connect (sigc::mem_fun (*this, &ExportReport::on_switch_page));
847 assert (with_file && !path.empty ());
848 std::string imgpath = Glib::build_filename (Glib::path_get_dirname (path), PBD::basename_nosuffix (path) + ".png");
849 PBD::info << string_compose(_("Writing Export Analysis Image: %1."), imgpath) << endmsg;
850 png_surface->write_to_png (imgpath);
854 pages.set_show_tabs (true);
856 pages.set_name ("ExportReportNotebook");
857 pages.set_current_page (0);
859 get_vbox ()->set_spacing (4);
860 get_vbox ()->pack_start (pages, false, false);
863 _session->AuditionActive.connect(auditioner_connections, invalidator (*this), boost::bind (&ExportReport::audition_active, this, _1), gui_context());
864 _session->the_auditioner()->AuditionProgress.connect(auditioner_connections, invalidator (*this), boost::bind (&ExportReport::audition_progress, this, _1, _2), gui_context());
867 if (_session && with_file) {
868 play_btn = add_button (Stock::MEDIA_PLAY, RESPONSE_ACCEPT);
869 stop_btn = add_button (Stock::MEDIA_STOP, RESPONSE_ACCEPT);
871 add_button (Stock::CLOSE, RESPONSE_CLOSE);
873 set_default_response (RESPONSE_CLOSE);
874 if (_session && with_file) {
875 stop_btn->signal_clicked().connect (sigc::mem_fun (*this, &ExportReport::stop_audition));
876 play_btn->signal_clicked().connect (sigc::mem_fun (*this, &ExportReport::play_audition));
877 stop_btn->set_sensitive (false);
886 int i = ArdourDialog::run ();
887 if (i == Gtk::RESPONSE_DELETE_EVENT || i == RESPONSE_CLOSE) {
893 _session->cancel_audition();
895 return RESPONSE_CLOSE;
899 ExportReport::open_folder (std::string p)
901 PBD::open_folder (Glib::path_get_dirname(p));
905 ExportReport::audition_active (bool active)
907 if (!stop_btn || !play_btn) {
910 stop_btn->set_sensitive (active);
911 play_btn->set_sensitive (!active);
913 if (!active && _audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
914 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
915 i != timeline[_audition_num].end();
917 (*i)->set_playhead (-1);
921 if (_audition_num >= 0 ) {
922 Widget *page = pages.get_nth_page (_audition_num);
923 HBox *box = static_cast<Gtk::HBox*> (pages.get_tab_label (*page));
925 (*(box->get_children().begin()))->hide ();
927 (*(box->get_children().begin()))->show ();
937 ExportReport::audition (std::string path, unsigned n_chn, int page)
940 _session->cancel_audition();
942 if (n_chn ==0) { return; }
944 /* can't really happen, unless the user replaces the file while the dialog is open.. */
945 if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
946 PBD::warning << string_compose(_("Could not read file: %1 (%2)."), path, strerror(errno)) << endmsg;
949 if (SMFSource::valid_midi_file (path)) { return; }
951 boost::shared_ptr<Region> r;
953 boost::shared_ptr<AudioFileSource> afs;
954 bool old_sbp = AudioSource::get_build_peakfiles ();
956 /* don't even think of building peakfiles for these files */
957 AudioSource::set_build_peakfiles (false);
959 for (unsigned int n = 0; n < n_chn; ++n) {
961 afs = boost::dynamic_pointer_cast<AudioFileSource> (
962 SourceFactory::createExternal (DataType::AUDIO, *_session,
964 Source::Flag (ARDOUR::AudioFileSource::NoPeakFile), false));
965 if (afs->sample_rate() != _session->nominal_frame_rate()) {
966 boost::shared_ptr<SrcFileSource> sfs (new SrcFileSource(*_session, afs, ARDOUR::SrcGood));
967 srclist.push_back(sfs);
969 srclist.push_back(afs);
971 } catch (failed_constructor& err) {
972 PBD::error << _("Could not access soundfile: ") << path << endmsg;
973 AudioSource::set_build_peakfiles (old_sbp);
978 AudioSource::set_build_peakfiles (old_sbp);
980 if (srclist.empty()) {
984 afs = boost::dynamic_pointer_cast<AudioFileSource> (srclist[0]);
985 std::string rname = region_name_from_path (afs->path(), false);
987 PBD::PropertyList plist;
989 plist.add (ARDOUR::Properties::start, 0);
990 plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->timeline_position()));
991 plist.add (ARDOUR::Properties::name, rname);
992 plist.add (ARDOUR::Properties::layer, 0);
994 r = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (srclist, plist, false));
997 _session->audition_region(r);
998 _audition_num = page;
1002 ExportReport::play_audition ()
1004 if (_audition_num >= 0 || !_session) { return; }
1005 if (files.find (_page_num) == files.end()) { return; }
1006 audition (files[_page_num].path, files[_page_num].channels, _page_num);
1010 ExportReport::stop_audition ()
1012 if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
1013 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1014 i != timeline[_audition_num].end();
1016 (*i)->set_playhead (-1);
1020 _session->cancel_audition();
1025 ExportReport::on_switch_page (GtkNotebookPage*, guint page_num)
1027 if (_audition_num == _page_num) {
1028 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1029 i != timeline[_audition_num].end();
1031 (*i)->set_playhead (-1);
1034 _page_num = page_num;
1038 ExportReport::audition_progress (framecnt_t pos, framecnt_t len)
1040 if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
1041 const float p = (float)pos / len;
1042 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1043 i != timeline[_audition_num].end();
1045 (*i)->set_playhead (p);
1051 ExportReport::audition_seek (int page, float pos)
1053 if (_audition_num == page && _session) {
1054 _session->the_auditioner()->seek_to_percent (100.f * pos);
1059 ExportReport::on_logscale_toggled (Gtk::ToggleButton* b)
1061 bool en = b->get_active ();
1062 for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
1063 (*i)->set_logscale (en);
1068 ExportReport::on_rectivied_toggled (Gtk::ToggleButton* b)
1070 bool en = b->get_active ();
1071 for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
1072 (*i)->set_rectified (en);
1077 ExportReport::draw_waveform (Cairo::RefPtr<Cairo::ImageSurface>& wave, ExportAnalysisPtr p, uint32_t c, int m_l, size_t width, int anw, int height_2, bool log, bool rect)
1080 Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (get_pango_context ());
1081 const float ht = 2.f * height_2;
1083 std::vector<double> dashes;
1084 dashes.push_back (3.0);
1085 dashes.push_back (5.0);
1087 wave = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, ht);
1088 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (wave);
1089 cr->set_operator (Cairo::OPERATOR_SOURCE);
1090 cr->rectangle (0, 0, m_l, ht);
1091 cr->set_source_rgba (0, 0, 0, 0);
1093 cr->rectangle (m_l, 0, width, ht);
1094 cr->set_source_rgba (0, 0, 0, 1.0);
1096 cr->set_operator (Cairo::OPERATOR_OVER);
1098 cr->set_source_rgba (.7, .7, .7, 1.0);
1099 cr->set_line_width (1.0);
1109 clip_top = ht * (1.f - alt_log_meter (-1));
1110 for (size_t x = 0 ; x < width; ++x) {
1111 const float v = alt_log_meter (fast_coefficient_to_dB (std::max (fabsf (p->peaks[c][x].max), fabsf (p->peaks[c][x].min))));
1112 cr->move_to (m_l + x - .5, ht - ht * v);
1113 cr->line_to (m_l + x - .5, ht);
1117 clip_top = ht * (1.f - dB_to_coefficient (-1));
1118 for (size_t x = 0 ; x < width; ++x) {
1119 const float v = std::max (fabsf (p->peaks[c][x].max), fabsf (p->peaks[c][x].min));
1120 cr->move_to (m_l + x - .5, ht - ht * v);
1121 cr->line_to (m_l + x - .5, ht);
1127 clip_top = height_2 - height_2 * alt_log_meter (-1);
1128 clip_bot = height_2 + height_2 * alt_log_meter (-1);
1129 for (size_t x = 0 ; x < width; ++x) {
1131 if (p->peaks[c][x].max > 0) {
1132 pmax = alt_log_meter (fast_coefficient_to_dB (p->peaks[c][x].max));
1134 pmax = -alt_log_meter (fast_coefficient_to_dB (-p->peaks[c][x].max));
1137 if (p->peaks[c][x].min > 0) {
1138 pmin = alt_log_meter (fast_coefficient_to_dB (p->peaks[c][x].min));
1140 pmin = -alt_log_meter (fast_coefficient_to_dB (-p->peaks[c][x].min));
1142 cr->move_to (m_l + x - .5, height_2 - height_2 * pmax);
1143 cr->line_to (m_l + x - .5, height_2 - height_2 * pmin);
1147 clip_top = height_2 - height_2 * dB_to_coefficient (-1);
1148 clip_bot = height_2 + height_2 * dB_to_coefficient (-1);
1149 for (size_t x = 0 ; x < width; ++x) {
1150 cr->move_to (m_l + x - .5, height_2 - height_2 * p->peaks[c][x].max);
1151 cr->line_to (m_l + x - .5, height_2 - height_2 * p->peaks[c][x].min);
1158 cr->set_source_rgba (1.0, 0, 0, 1.0);
1159 for (size_t x = 0 ; x < width; ++x) {
1160 if (p->peaks[c][x].max >= 1.0) {
1161 cr->move_to (m_l + x - .5, 0);
1162 cr->line_to (m_l + x - .5, clip_top);
1164 if (p->peaks[c][x].min <= -1.0) {
1165 cr->move_to (m_l + x - .5, clip_bot);
1166 cr->line_to (m_l + x - .5, ht);
1171 // >= -1dBTP (coeff >= .89125, libs/vamp-plugins/TruePeak.cpp)
1172 cr->set_source_rgba (1.0, 0.7, 0, 0.7);
1173 for (std::set<framepos_t>::const_iterator i = p->truepeakpos[c].begin (); i != p->truepeakpos[c].end (); ++i) {
1174 cr->move_to (m_l + (*i) - .5, clip_top);
1175 cr->line_to (m_l + (*i) - .5, clip_bot);
1181 cr->set_source_rgba (.3, .3, .3, 0.7);
1182 cr->move_to (m_l + 0, height_2 - .5);
1183 cr->line_to (m_l + width, height_2 - .5);
1188 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
1189 layout->set_alignment (Pango::ALIGN_LEFT);
1190 layout->set_text (_("dBFS"));
1191 layout->get_pixel_size (w, h);
1192 cr->move_to (rint (m_l - h - anw - 10), rint (height_2 + w * .5));
1193 cr->set_source_rgba (.9, .9, .9, 1.0);
1195 cr->rotate (M_PI / -2.0);
1196 layout->show_in_cairo_context (cr);
1200 cr->set_line_width (1.0);
1201 cr->set_dash (dashes, 2.0);
1202 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
1204 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
1208 XAXISLABEL ((ht - ht * alt_log_meter (-36)), _("-36"));
1209 XAXISLABEL ((ht - ht * alt_log_meter (-18)), _("-18"));
1210 XAXISLABEL ((ht - ht * alt_log_meter (-9)), _("-9"));
1211 XAXISLABEL ((ht - ht * alt_log_meter (-3)), _("-3"));
1213 XAXISLABEL ((ht - ht * .1259), _("-18"));
1214 XAXISLABEL ((ht - ht * .3548), _("-9"));
1215 XAXISLABEL ((ht - ht * .7079), _("-3"));
1219 XAXISLABEL ((height_2 - height_2 * alt_log_meter (-18)), _("-18"));
1220 XAXISLABEL ((height_2 - height_2 * alt_log_meter (-9)), _("-9"));
1221 XAXISLABEL ((height_2 - height_2 * alt_log_meter (-3)), _("-3"));
1222 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-18)), _("-18"));
1223 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-9)), _("-9"));
1224 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-3)), _("-3"));
1226 XAXISLABEL (height_2 * 0.6452, _("-9"));
1227 XAXISLABEL (height_2 * 1.3548, _("-9"));
1228 XAXISLABEL (height_2 * 0.2921, _("-3"));
1229 XAXISLABEL (height_2 * 1.7079, _("-3"));