2 * Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2016-2018 Robin Gareus <robin@gareus.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <pangomm/layout.h>
23 #include <gtkmm/label.h>
24 #include <gtkmm/table.h>
25 #include <gtkmm/stock.h>
27 #include "pbd/openuri.h"
28 #include "pbd/basename.h"
30 #include "gtkmm2ext/utils.h"
31 #include "gtkmm2ext/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 samplecnt_t file_length = 0;
128 samplecnt_t sample_rate = 0;
129 samplecnt_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 samplecnt_t const nfr = _session ? _session->nominal_sample_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) {
187 /* Note: errmsg can have size = 1, and contain "\0\0" */
188 if (!errmsg.empty() && 0 != strlen(errmsg.c_str())) {
189 l = manage (new Label (_("Error:"), ALIGN_END));
190 t->attach (*l, 0, 1, 1, 2);
191 l = manage (new Label (errmsg, ALIGN_START));
192 t->attach (*l, 1, 4, 1, 2);
197 Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (get_pango_context ());
199 // calc geometry of numerics
200 const float dbfs = accurate_coefficient_to_dB (p->peak);
201 const float dbtp = accurate_coefficient_to_dB (p->truepeak);
203 #define TXTSIZE(LINE, TXT, FONT) { \
204 layout->set_font_description (UIConfiguration::instance ().FONT ()); \
205 layout->set_text (TXT); \
206 layout->get_pixel_size (w, h); \
207 if (w > mnw) { mnw = w; } \
208 if (h > lin[LINE]) { lin[LINE] = h; } \
211 #define TXTWIDTH(TXT, FONT) { \
212 layout->set_font_description (UIConfiguration::instance ().FONT ()); \
213 layout->set_text (TXT); \
214 layout->get_pixel_size (w, h); \
215 if (w > mml) { mml = w; } \
218 int m_r = 0; // right side
219 int mnh = 0; // mono height
220 int mnw = 0; // max numeric width
221 int anw = 0; // spectrum annotation text width
223 int lin[6] = { 0, 0, 0, 0, 0, 0 }; // max line height
225 TXTSIZE(0, _("(too short integration time)"), get_SmallFont);
227 TXTSIZE(0, _("-888"), get_SmallMonospaceFont);
232 TXTSIZE(0, _("Peak:"), get_SmallFont);
233 TXTSIZE(1, string_compose (_("%1 dBFS"), std::setprecision (1), std::fixed, dbfs), get_LargeFont);
234 TXTSIZE(2, _("True Peak:"), get_SmallFont);
235 TXTSIZE(3, string_compose (_("%1 dBTP"), std::setprecision (1), std::fixed, dbtp), get_LargeFont);
236 TXTSIZE(4, _("Normalization Gain:"), get_SmallFont);
237 TXTSIZE(5, _("+888.88 dB"), get_SmallMonospaceFont);
239 TXTSIZE(0, _("Integrated Loudness:"), get_SmallFont);
240 TXTSIZE(1, string_compose (_("%1 LUFS"), std::setprecision (1), std::fixed, p->loudness), get_LargeFont);
241 TXTSIZE(2, _("Loudness Range:"), get_SmallFont);
242 TXTSIZE(3, string_compose (_("%1 LU"), std::setprecision (1), std::fixed, p->loudness_range), get_LargeFont);
245 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];
246 const int hh = std::max (100, ht + 12);
247 const int htn = lin[0] * 1.25 + lin[1] * 1.25 + lin[2] * 1.25 + lin[3];
248 int m_l = 2 * mnw + /*hist-width*/ 540 + /*box spacing*/ 8 - /*peak-width*/ 800 - m_r; // margin left
250 int mml = 0; // min margin left -- ensure left margin is wide enough
251 TXTWIDTH (_("Time"), get_SmallFont);
252 TXTWIDTH (_("100"), get_SmallMonospaceFont);
253 m_l = (std::max(anw + mnh + 14, std::max (m_l, mml + 8)) + 3) & ~3;
255 mnw = (m_l - /*hist-width*/ 540 - /*box spacing*/ 8 + /*peak-width*/ 800 + m_r) / 2;
256 const int nw2 = mnw / 2; // nums, horizontal center
260 y0[0] = (hh - ht) * .5;
262 y0[0] = (hh - htn) * .5;
264 y0[1] = y0[0] + lin[0] * 1.25;
265 y0[2] = y0[1] + lin[1] * 1.25;
266 y0[3] = y0[2] + lin[2] * 1.25;
267 y0[4] = y0[3] + lin[3] * 1.25;
268 y0[5] = y0[4] + lin[4] * 1.25;
270 /* calc heights & alignment of png-image */
271 const float specth = sizeof (p->spectrum[0]) / sizeof (float);
272 const float waveh2 = std::min (100, 8 * lin[0] / (int) p->n_channels);
274 Cairo::RefPtr<Cairo::ImageSurface> png_surface;
278 if (with_file && UIConfiguration::instance().get_save_export_analysis_image ()) { /*png image */
279 const int top_w = 540 + 2 * (mnw + 4); // 4px spacing
280 const int wav_w = m_l + m_r + 4 + sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
281 const int spc_w = m_l + m_r + 4 + sizeof (p->spectrum) / sizeof (float) / specth;
285 if (channels > 0 && file_length > 0 && sample_rate > 0) {
286 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
287 layout->set_text (_("00:00:00.000"));
288 layout->get_pixel_size (w, h);
289 int height = h * 1.75;
290 ann_h = 4 + height /* Time Axis */;
292 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
293 layout->set_text (_("0|A8"));
294 layout->get_pixel_size (w, h);
296 ann_h += 4 + 3 * linesp; /* File Info */;
299 const int png_h = hh + 4 + p->n_channels * (2 * waveh2 + 4) + ann_h + specth + 4;
300 png_w = std::max (std::max (top_w, wav_w), spc_w);
302 png_surface = Cairo::ImageSurface::create (Cairo::FORMAT_RGB24, png_w, png_h);
303 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
304 pcx->set_source_rgb (.2, .2, .2);
307 if (channels > 0 && file_length > 0 && sample_rate > 0) {
309 // Add file-name, format, duration, sample-rate & timecode
310 pcx->set_source_rgb (.7, .7, .7);
311 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
312 layout->set_alignment (Pango::ALIGN_LEFT);
314 #define IMGLABEL(X0, STR, VAL) { \
315 layout->set_text (STR); \
316 pcx->move_to (X0, png_y0); \
317 layout->get_pixel_size (w, h); \
318 layout->show_in_cairo_context (pcx); \
319 layout->set_text (VAL); \
320 pcx->move_to (X0 + w + 2, png_y0); \
321 layout->show_in_cairo_context (pcx); \
324 // TODO get max width of labels per column, right-align labels, x-align 1/3, 2/3 columns
326 const int lx1 = m_l + png_w * 2 / 3; // right-col is short (channels, SR, duration)
327 std::string sha1sum = ARDOUR::compute_sha1_of_file (path);
328 if (!sha1sum.empty()) {
329 sha1sum = " (sha1: " + sha1sum + ")";
332 IMGLABEL (lx0, _("File:"), Glib::path_get_basename (path) + sha1sum);
333 IMGLABEL (lx1, _("Channels:"), string_compose ("%1", channels));
336 IMGLABEL (lx0, _("Format:"), file_fmt);
337 IMGLABEL (lx1, _("Sample rate:"), string_compose (_("%1 Hz"), sample_rate));
342 _session->sample_to_timecode (start_off, tct, false, false);
343 IMGLABEL (lx0, _("Timecode:"), Timecode::timecode_format_time (tct));
345 IMGLABEL (lx1, _("Duration:"), Timecode::timecode_format_sampletime (file_length, sample_rate, 1000, false));
350 { /* peak, loudness and R128 histogram */
351 Cairo::RefPtr<Cairo::ImageSurface> nums = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, mnw, hh);
352 Cairo::RefPtr<Cairo::ImageSurface> ebur = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, mnw, hh);
353 Cairo::RefPtr<Cairo::ImageSurface> hist = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, 540, hh);
355 /* peak and true-peak numerics */
356 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (nums);
357 cr->set_source_rgba (0, 0, 0, 1.0);
360 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
361 layout->set_alignment (Pango::ALIGN_LEFT);
362 layout->set_text (_("Peak:"));
363 layout->get_pixel_size (w, h);
364 cr->move_to (rint (nw2 - w * .5), y0[0]);
365 cr->set_source_rgba (.7, .7, .7, 1.0);
366 layout->show_in_cairo_context (cr);
368 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
369 layout->set_text (string_compose (_("%1 dBFS"), std::setprecision (1), std::fixed, dbfs));
370 layout->get_pixel_size (w, h);
371 cr->move_to (rint (nw2 - w * .5), y0[1]);
372 if (dbfs >= 0.f) { cr->set_source_rgba (1.0, .1, .1, 1.0); }
373 else if (dbfs > -1.f) { cr->set_source_rgba (1.0, .7, .0, 1.0); }
374 layout->show_in_cairo_context (cr);
377 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
378 layout->set_text (_("True Peak:"));
379 layout->get_pixel_size (w, h);
380 cr->move_to (rint (nw2 - w * .5), y0[2]);
381 cr->set_source_rgba (.7, .7, .7, 1.0);
382 layout->show_in_cairo_context (cr);
384 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
385 layout->set_text (string_compose (_("%1 dBTP"), std::setprecision (1), std::fixed, dbtp));
386 layout->get_pixel_size (w, h);
387 cr->move_to (rint (nw2 - w * .5), y0[3]);
388 if (dbtp >= 0.f) { cr->set_source_rgba (1.0, .1, .1, 1.0); }
389 else if (dbtp > -1.f) { cr->set_source_rgba (1.0, .7, .0, 1.0); }
390 layout->show_in_cairo_context (cr);
394 const float ndb = accurate_coefficient_to_dB (p->norm_gain_factor);
395 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
396 layout->set_text (_("Normalization Gain:"));
397 layout->get_pixel_size (w, h);
398 cr->move_to (rint (nw2 - w * .5), y0[4]);
399 cr->set_source_rgba (.7, .7, .7, 1.0);
400 layout->show_in_cairo_context (cr);
402 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
403 layout->set_text (string_compose (_("%1 dB"), std::setprecision (2), std::showpos, std::fixed, ndb));
405 layout->get_pixel_size (w, h);
406 cr->move_to (rint (nw2 - w * .5), y0[5]);
407 // TODO tweak thresholds
408 if (p->norm_gain_factor < 1.0) {
409 cr->set_source_rgba (1.0, .7, .1, 1.0);
410 } else if (p->norm_gain_factor == 1.0) {
411 cr->set_source_rgba (.7, .7, .7, 1.0);
412 } else if (fabsf (ndb) < 12) {
413 cr->set_source_rgba (.1, 1.0, .1, 1.0);
414 } else if (fabsf (ndb) < 18) {
415 cr->set_source_rgba (1.0, .7, .1, 1.0);
417 cr->set_source_rgba (1.0, .1, .1, 1.0);
419 layout->show_in_cairo_context (cr);
424 /* EBU R128 numerics */
425 cr = Cairo::Context::create (ebur);
426 cr->set_source_rgba (0, 0, 0, 1.0);
429 cr->set_source_rgba (.7, .7, .7, 1.0);
431 if (!i->second->have_loudness) {
432 layout->set_alignment (Pango::ALIGN_CENTER);
433 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
434 layout->set_text (_("Not\nAvailable"));
435 layout->get_pixel_size (w, h);
436 cr->move_to (rint (nw2 - w * .5), rint ((hh - h) * .5));
437 layout->show_in_cairo_context (cr);
439 else if (p->loudness == -200 && p->loudness_range == 0) {
440 layout->set_alignment (Pango::ALIGN_CENTER);
441 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
442 layout->set_text (_("Not\nAvailable"));
443 layout->get_pixel_size (w, h);
444 cr->move_to (rint (nw2 - w * .5), rint (hh * .5 - h * .66));
445 layout->show_in_cairo_context (cr);
448 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
449 layout->set_text (_("(too short integration time)"));
450 layout->get_pixel_size (w, h);
451 cr->move_to (rint (nw2 - w * .5), rint (hh * .5 + yy));
452 layout->show_in_cairo_context (cr);
455 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
456 layout->set_alignment (Pango::ALIGN_LEFT);
457 layout->set_text (_("Integrated Loudness:"));
458 layout->get_pixel_size (w, h);
459 cr->move_to (rint (nw2 - w * .5), y0[0]);
460 layout->show_in_cairo_context (cr);
462 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
463 layout->set_text (string_compose (_("%1 LUFS"), std::setprecision (1), std::fixed, p->loudness));
464 layout->get_pixel_size (w, h);
465 cr->move_to (rint (nw2 - w * .5), y0[1]);
466 layout->show_in_cairo_context (cr);
468 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
469 layout->set_text (_("Loudness Range:"));
470 layout->get_pixel_size (w, h);
471 cr->move_to (rint (nw2 - w * .5), y0[2]);
472 layout->show_in_cairo_context (cr);
474 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
475 layout->set_text (string_compose (_("%1 LU"), std::setprecision (1), std::fixed, p->loudness_range));
476 layout->get_pixel_size (w, h);
477 cr->move_to (rint (nw2 - w * .5), y0[3]);
478 layout->show_in_cairo_context (cr);
482 /* draw loudness histogram */
483 cr = Cairo::Context::create (hist);
484 cr->set_source_rgba (0, 0, 0, 1.0);
487 cr->set_source_rgba (.7, .7, .7, 1.0);
488 cr->set_line_width (1.0);
490 if (p->loudness_hist_max > 0 && i->second->have_loudness) {
492 for (size_t x = 0 ; x < 510; ++x) {
493 cr->move_to (x - .5, hh);
494 cr->line_to (x - .5, (float) hh * (1.0 - p->loudness_hist[x] / (float) p->loudness_hist_max));
498 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
499 layout->set_alignment (Pango::ALIGN_CENTER);
502 layout->set_text (_("LUFS\n(short)"));
503 layout->get_pixel_size (w, h);
504 Gtkmm2ext::rounded_rectangle (cr, 5, 5, w + 2, h + 2, 4);
505 cr->set_source_rgba (.1, .1, .1, 0.7);
508 cr->set_source_rgba (.9, .9, .9, 1.0);
509 layout->show_in_cairo_context (cr);
512 layout->set_text (_("Multiplicity"));
513 layout->get_pixel_size (w, h);
514 Gtkmm2ext::rounded_rectangle (cr, 5, hh - w - 3, h + 2, w + 2, 4);
515 cr->set_source_rgba (.1, .1, .1, 0.7);
518 cr->move_to (6, hh - 2);
519 cr->set_source_rgba (.9, .9, .9, 1.0);
520 cr->rotate (M_PI / -2.0);
521 layout->show_in_cairo_context (cr);
525 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
526 layout->set_alignment (Pango::ALIGN_LEFT);
527 for (int g = -53; g <= -8; g += 5) {
528 // grid-lines. [110] -59LUFS .. [650]: -5 LUFS
529 layout->set_text (string_compose ("%1", std::setw(3), std::setfill(' '), g));
530 layout->get_pixel_size (w, h);
532 cr->set_operator (Cairo::OPERATOR_OVER);
533 Gtkmm2ext::rounded_rectangle (cr,
534 rint ((g + 59.0) * 10.0 - h * .5), 5,
536 const float pk = (g + 59.0) / 54.0;
537 Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, .3 + pk * .4, .6);
538 Gtkmm2ext::set_source_rgba (cr, c);
542 cr->set_source_rgba (.9, .9, .9, 1.0);
543 cr->move_to (rint ((g + 59.0) * 10.0 - h * .5), w + 6.0);
544 cr->rotate (M_PI / -2.0);
545 layout->show_in_cairo_context (cr);
548 cr->set_operator (Cairo::OPERATOR_ADD);
550 cr->set_source_rgba (.3, .3, .3, 1.0);
551 cr->set_dash (dashes, 1.0);
552 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
553 cr->move_to (rint ((g + 59.0) * 10.0) + .5, w + 8.0);
554 cr->line_to (rint ((g + 59.0) * 10.0) + .5, hh);
560 layout->set_alignment (Pango::ALIGN_CENTER);
561 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
562 layout->set_text (_("Not\nAvailable"));
563 layout->get_pixel_size (w, h);
564 cr->move_to (rint ((510 - w) * .5), rint ((hh - h) * .5));
565 layout->show_in_cairo_context (cr);
571 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
572 pcx->set_source (nums, 0, png_y0);
574 pcx->set_source (hist, (png_w - 540) / 2, png_y0);
576 pcx->set_source (ebur, png_w - mnw, png_y0);
581 CimgArea *nu = manage (new CimgArea (nums));
582 CimgArea *eb = manage (new CimgArea (ebur));
583 CimgArea *hi = manage (new CimgArea (hist));
584 HBox *hb = manage (new HBox ());
586 hb->pack_start (*nu, false, false);
587 hb->pack_start (*hi, false, false);
588 hb->pack_start (*eb, false, false);
590 wtbl->attach (*hb, 0, 2, wrow, wrow + 1, SHRINK, SHRINK);
594 #define XAXISLABEL(POS, TXT) { \
595 const float yy = rint (POS); \
596 layout->set_text (TXT); \
597 layout->get_pixel_size (w, h); \
598 cr->move_to (m_l - 8 - w, rint ((POS) - h * .5)); \
599 cr->set_source_rgba (.9, .9, .9, 1.0); \
600 cr->set_operator (Cairo::OPERATOR_OVER); \
601 layout->show_in_cairo_context (cr); \
602 cr->move_to (m_l - 4, yy - .5); \
603 cr->line_to (m_l + width, yy - .5); \
604 cr->set_source_rgba (.3, .3, .3, 1.0); \
605 cr->set_operator (Cairo::OPERATOR_ADD); \
611 VBox *lrb = manage (new VBox());
612 ToggleButton *log = manage (new ToggleButton (S_("Logscale|Lg")));
613 ToggleButton *rec = manage (new ToggleButton (S_("Rectified|Rf")));
614 Gtkmm2ext::UI::instance()->set_tip (log, _("Logscale"));
615 Gtkmm2ext::UI::instance()->set_tip (rec, _("Rectified"));
617 lrb->pack_start (*log, false, false, 5);
618 lrb->pack_end (*rec, false, false, 5);
619 log->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_logscale_toggled), log));
620 rec->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_rectivied_toggled), rec));
622 wtbl->attach (*lrb, 1, 2, wrow, wrow + p->n_channels, SHRINK, SHRINK);
625 for (uint32_t c = 0; c < p->n_channels; ++c) {
627 const size_t width = sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
629 Cairo::RefPtr<Cairo::ImageSurface> wave;
630 Cairo::RefPtr<Cairo::ImageSurface> wave_log;
631 Cairo::RefPtr<Cairo::ImageSurface> wave_rect;
632 Cairo::RefPtr<Cairo::ImageSurface> wave_lr;
633 draw_waveform(wave, p, c, m_l, width, anw, waveh2, false, false);
634 draw_waveform(wave_log, p, c, m_l, width, anw, waveh2, true, false);
635 draw_waveform(wave_rect, p, c, m_l, width, anw, waveh2, false, true);
636 draw_waveform(wave_lr, p, c, m_l, width, anw, waveh2, true, true);
638 CimgWaveArea *wv = manage (new CimgWaveArea (wave, wave_log, wave_rect, wave_lr, m_l, width));
640 playhead_widgets.push_back (wv);
641 waves.push_back (wv);
642 wv->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
643 wtbl->attach (*wv, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
647 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
648 pcx->set_source (wave, 0, png_y0);
650 png_y0 += 2 * waveh2 + 4;
654 if (channels > 0 && file_length > 0 && sample_rate > 0)
656 /* Time Axis -- re-use waveform width */
657 const size_t width = sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
658 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
659 layout->set_text (_("00:00:00.000"));
660 layout->get_pixel_size (w, h);
661 int height = h * 1.75;
662 Cairo::RefPtr<Cairo::ImageSurface> ytme = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, height);
663 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (ytme);
664 cr->set_operator (Cairo::OPERATOR_SOURCE);
665 cr->set_source_rgba (0, 0, 0, 1.0);
667 cr->rectangle (0, 0, m_l, height);
668 cr->set_source_rgba (0, 0, 0, 0);
670 cr->set_operator (Cairo::OPERATOR_OVER);
672 cr->set_line_width (1.0);
673 for (int i = 0; i <= 4; ++i) {
674 const float fract = (float) i / 4.0;
675 // " XX:XX:XX.XXX" [space/minus] 12 chars = 13.
676 const float xalign = (i == 4) ? 1.0 : (i == 0) ? 1.0 / 13.0 : 7.0 / 13.0;
679 AudioClock::print_minsec (start_off + file_length * fract,
680 buf, sizeof (buf), sample_rate);
682 layout->set_text (buf);
683 layout->get_pixel_size (w, h);
684 cr->move_to (rint (m_l + width * fract - w * xalign), rint (.5 * (height - h)));
685 cr->set_source_rgba (.9, .9, .9, 1.0);
686 layout->show_in_cairo_context (cr);
688 cr->set_source_rgba (.7, .7, .7, 1.0);
689 cr->move_to (rint (m_l + width * fract) - .5, 0);
690 cr->line_to (rint (m_l + width * fract) - .5, ceil (height * .15));
691 cr->move_to (rint (m_l + width * fract) - .5, floor (height * .85));
692 cr->line_to (rint (m_l + width * fract) - .5, height);
696 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
697 layout->set_text (_("Time"));
698 cr->set_source_rgba (.9, .9, .9, 1.0);
699 layout->get_pixel_size (w, h);
700 cr->move_to (rint (m_l - w - 8), rint (.5 * (height - h)));
701 layout->show_in_cairo_context (cr);
704 CimgPlayheadArea *tm = manage (new CimgPlayheadArea (ytme, m_l, width, true));
705 playhead_widgets.push_back (tm);
706 tm->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
707 wtbl->attach (*tm, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
711 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
712 pcx->set_source (ytme, 0, png_y0);
714 png_y0 += height + 4;
720 const size_t height = specth;
721 const size_t swh = sizeof (p->spectrum) / sizeof (float);
722 const size_t width = swh / height;
724 Cairo::RefPtr<Cairo::ImageSurface> spec = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, height);
725 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (spec);
726 cr->set_operator (Cairo::OPERATOR_SOURCE);
727 cr->rectangle (0, 0, m_l, height);
728 cr->set_source_rgba (0, 0, 0, 0);
730 cr->rectangle (m_l, 0, width, height);
731 cr->set_source_rgba (0, 0, 0, 1.0);
733 cr->set_operator (Cairo::OPERATOR_OVER);
735 for (size_t x = 0 ; x < width; ++x) {
736 for (size_t y = 0 ; y < height; ++y) {
737 const float pk = p->spectrum[x][y];
738 Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
739 Gtkmm2ext::set_source_rgba (cr, c);
740 cr->rectangle (m_l + x - .5, y - .5, 1, 1);
746 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
747 layout->set_text (_("Hz"));
748 layout->get_pixel_size (w, h);
749 cr->move_to (rint (m_l - h - anw - 10), rint ((height + w) * .5));
750 cr->set_source_rgba (.9, .9, .9, 1.0);
752 cr->rotate (M_PI / -2.0);
753 layout->show_in_cairo_context (cr);
757 cr->set_line_width (1.0);
758 cr->set_dash (dashes, 2.0);
759 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
761 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
762 //XAXISLABEL (p->freq[0], _("50Hz"));
763 XAXISLABEL (p->freq[1], _("100"));
764 XAXISLABEL (p->freq[2], _("500"));
765 XAXISLABEL (p->freq[3], _("1K"));
766 XAXISLABEL (p->freq[4], _("5K"));
767 XAXISLABEL (p->freq[5], _("10K"));
771 Cairo::RefPtr<Cairo::ImageSurface> scale = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_r, height);
772 cr = Cairo::Context::create (scale);
773 cr->set_operator (Cairo::OPERATOR_SOURCE);
774 cr->rectangle (0, 0, m_r, height);
775 cr->set_source_rgba (0, 0, 0, 0);
778 cr->set_operator (Cairo::OPERATOR_OVER);
779 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
780 layout->set_alignment (Pango::ALIGN_LEFT);
781 layout->set_text (_("dBFS"));
782 layout->get_pixel_size (w, h);
783 cr->move_to (rint (.5 * (m_r - w)), height - h - 2);
784 cr->set_source_rgba (.9, .9, .9, 1.0);
785 layout->show_in_cairo_context (cr);
787 int innertop = ceil (mnh * .5) + 1;
788 size_t innerheight = (height - 2 * innertop - h - 2);
790 cr->rectangle (1, innertop - 1, m_r - 2 - anw, innerheight + 2);
791 cr->set_source_rgba (0, 0, 0, 1.0);
792 cr->fill_preserve ();
793 cr->set_line_width (1.0);
794 cr->set_source_rgba (.7, .7, .6, 1.0);
797 for (size_t y = 0 ; y < innerheight - 2; ++y) {
798 const float pk = 1.0 - (float) y / innerheight;
799 Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
800 Gtkmm2ext::set_source_rgba (cr, c);
801 cr->rectangle (2, innertop + y + .5, m_r - 4 - anw, 1);
805 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
806 for (int i = 0; i <= 4; ++i) {
807 const float fract = (float) i / 4.0;
808 const float yalign = .5; // (i == 4) ? 0 : (i == 0) ? 1.0 : .5;
810 snprintf (buf, sizeof (buf), "%.0f", AudioGrapher::Analyser::fft_range_db * -fract);
811 layout->set_text (buf);
812 layout->get_pixel_size (w, h);
814 cr->move_to (m_r - anw, rint (innertop + fract * innerheight - h * yalign));
815 cr->set_source_rgba (.9, .9, .9, 1.0);
816 layout->show_in_cairo_context (cr);
820 CimgPlayheadArea *sp = manage (new CimgPlayheadArea (spec, m_l, width));
821 playhead_widgets.push_back (sp);
822 sp->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
823 CimgArea *an = manage (new CimgArea (scale));
824 wtbl->attach (*sp, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
825 wtbl->attach (*an, 1, 2, wrow, wrow + 1, SHRINK, SHRINK);
829 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
830 pcx->set_source (spec, 0, png_y0);
832 pcx->set_source (scale, png_w - m_r, png_y0);
837 timeline[page] = playhead_widgets;
839 HBox *tab = manage (new HBox ());
840 l = manage (new Label (Glib::path_get_basename (path)));
841 Gtk::Image *img = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_MENU));
842 tab->pack_start (*img);
843 tab->pack_start (*l);
847 pages.pages ().push_back (Notebook_Helpers::TabElem (*vb, *tab));
848 pages.signal_switch_page().connect (sigc::mem_fun (*this, &ExportReport::on_switch_page));
851 assert (with_file && !path.empty ());
852 std::string imgpath = Glib::build_filename (Glib::path_get_dirname (path), PBD::basename_nosuffix (path) + ".png");
853 PBD::info << string_compose(_("Writing Export Analysis Image: %1."), imgpath) << endmsg;
854 png_surface->write_to_png (imgpath);
858 pages.set_show_tabs (true);
860 pages.set_name ("ExportReportNotebook");
861 pages.set_current_page (0);
863 get_vbox ()->set_spacing (4);
864 get_vbox ()->pack_start (pages, false, false);
867 _session->AuditionActive.connect(auditioner_connections, invalidator (*this), boost::bind (&ExportReport::audition_active, this, _1), gui_context());
868 _session->the_auditioner()->AuditionProgress.connect(auditioner_connections, invalidator (*this), boost::bind (&ExportReport::audition_progress, this, _1, _2), gui_context());
871 if (_session && with_file) {
872 play_btn = add_button (Stock::MEDIA_PLAY, RESPONSE_ACCEPT);
873 stop_btn = add_button (Stock::MEDIA_STOP, RESPONSE_ACCEPT);
875 add_button (Stock::CLOSE, RESPONSE_CLOSE);
877 set_default_response (RESPONSE_CLOSE);
878 if (_session && with_file) {
879 stop_btn->signal_clicked().connect (sigc::mem_fun (*this, &ExportReport::stop_audition));
880 play_btn->signal_clicked().connect (sigc::mem_fun (*this, &ExportReport::play_audition));
881 stop_btn->set_sensitive (false);
890 int i = ArdourDialog::run ();
891 if (i == Gtk::RESPONSE_DELETE_EVENT || i == RESPONSE_CLOSE) {
897 _session->cancel_audition();
899 return RESPONSE_CLOSE;
903 ExportReport::open_folder (std::string p)
905 PBD::open_folder (Glib::path_get_dirname(p));
909 ExportReport::audition_active (bool active)
911 if (!stop_btn || !play_btn) {
914 stop_btn->set_sensitive (active);
915 play_btn->set_sensitive (!active);
917 if (!active && _audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
918 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
919 i != timeline[_audition_num].end();
921 (*i)->set_playhead (-1);
925 if (_audition_num >= 0 ) {
926 Widget *page = pages.get_nth_page (_audition_num);
927 HBox *box = static_cast<Gtk::HBox*> (pages.get_tab_label (*page));
929 (*(box->get_children().begin()))->hide ();
931 (*(box->get_children().begin()))->show ();
941 ExportReport::audition (std::string path, unsigned n_chn, int page)
944 _session->cancel_audition();
946 if (n_chn ==0) { return; }
948 /* can't really happen, unless the user replaces the file while the dialog is open.. */
949 if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
950 PBD::warning << string_compose(_("Could not read file: %1 (%2)."), path, strerror(errno)) << endmsg;
953 if (SMFSource::valid_midi_file (path)) { return; }
955 boost::shared_ptr<Region> r;
957 boost::shared_ptr<AudioFileSource> afs;
958 bool old_sbp = AudioSource::get_build_peakfiles ();
960 /* don't even think of building peakfiles for these files */
961 AudioSource::set_build_peakfiles (false);
963 for (unsigned int n = 0; n < n_chn; ++n) {
965 afs = boost::dynamic_pointer_cast<AudioFileSource> (
966 SourceFactory::createExternal (DataType::AUDIO, *_session,
968 Source::Flag (ARDOUR::AudioFileSource::NoPeakFile), false));
969 if (afs->sample_rate() != _session->nominal_sample_rate()) {
970 boost::shared_ptr<SrcFileSource> sfs (new SrcFileSource(*_session, afs, ARDOUR::SrcGood));
971 srclist.push_back(sfs);
973 srclist.push_back(afs);
975 } catch (failed_constructor& err) {
976 PBD::error << _("Could not access soundfile: ") << path << endmsg;
977 AudioSource::set_build_peakfiles (old_sbp);
982 AudioSource::set_build_peakfiles (old_sbp);
984 if (srclist.empty()) {
988 afs = boost::dynamic_pointer_cast<AudioFileSource> (srclist[0]);
989 std::string rname = region_name_from_path (afs->path(), false);
991 PBD::PropertyList plist;
993 plist.add (ARDOUR::Properties::start, 0);
994 plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->natural_position()));
995 plist.add (ARDOUR::Properties::name, rname);
996 plist.add (ARDOUR::Properties::layer, 0);
998 r = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (srclist, plist, false));
1001 _session->audition_region(r);
1002 _audition_num = page;
1006 ExportReport::play_audition ()
1008 if (_audition_num >= 0 || !_session) { return; }
1009 if (files.find (_page_num) == files.end()) { return; }
1010 audition (files[_page_num].path, files[_page_num].channels, _page_num);
1014 ExportReport::stop_audition ()
1016 if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
1017 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1018 i != timeline[_audition_num].end();
1020 (*i)->set_playhead (-1);
1024 _session->cancel_audition();
1029 ExportReport::on_switch_page (GtkNotebookPage*, guint page_num)
1031 if (_audition_num == _page_num) {
1032 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1033 i != timeline[_audition_num].end();
1035 (*i)->set_playhead (-1);
1038 _page_num = page_num;
1042 ExportReport::audition_progress (samplecnt_t pos, samplecnt_t len)
1044 if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
1045 const float p = (float)pos / len;
1046 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1047 i != timeline[_audition_num].end();
1049 (*i)->set_playhead (p);
1055 ExportReport::audition_seek (int page, float pos)
1057 if (_audition_num == page && _session) {
1058 _session->the_auditioner()->seek_to_percent (100.f * pos);
1063 ExportReport::on_logscale_toggled (Gtk::ToggleButton* b)
1065 bool en = b->get_active ();
1066 for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
1067 (*i)->set_logscale (en);
1072 ExportReport::on_rectivied_toggled (Gtk::ToggleButton* b)
1074 bool en = b->get_active ();
1075 for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
1076 (*i)->set_rectified (en);
1081 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)
1084 Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (get_pango_context ());
1085 const float ht = 2.f * height_2;
1087 std::vector<double> dashes;
1088 dashes.push_back (3.0);
1089 dashes.push_back (5.0);
1091 wave = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, ht);
1092 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (wave);
1093 cr->set_operator (Cairo::OPERATOR_SOURCE);
1094 cr->rectangle (0, 0, m_l, ht);
1095 cr->set_source_rgba (0, 0, 0, 0);
1097 cr->rectangle (m_l, 0, width, ht);
1098 cr->set_source_rgba (0, 0, 0, 1.0);
1100 cr->set_operator (Cairo::OPERATOR_OVER);
1102 cr->set_source_rgba (.7, .7, .7, 1.0);
1103 cr->set_line_width (1.0);
1113 clip_top = ht * (1.f - alt_log_meter (-1));
1114 for (size_t x = 0 ; x < width; ++x) {
1115 const float v = alt_log_meter (fast_coefficient_to_dB (std::max (fabsf (p->peaks[c][x].max), fabsf (p->peaks[c][x].min))));
1116 cr->move_to (m_l + x - .5, ht - ht * v);
1117 cr->line_to (m_l + x - .5, ht);
1121 clip_top = ht * (1.f - dB_to_coefficient (-1));
1122 for (size_t x = 0 ; x < width; ++x) {
1123 const float v = std::max (fabsf (p->peaks[c][x].max), fabsf (p->peaks[c][x].min));
1124 cr->move_to (m_l + x - .5, ht - ht * v);
1125 cr->line_to (m_l + x - .5, ht);
1131 clip_top = height_2 - height_2 * alt_log_meter (-1);
1132 clip_bot = height_2 + height_2 * alt_log_meter (-1);
1133 for (size_t x = 0 ; x < width; ++x) {
1135 if (p->peaks[c][x].max > 0) {
1136 pmax = alt_log_meter (fast_coefficient_to_dB (p->peaks[c][x].max));
1138 pmax = -alt_log_meter (fast_coefficient_to_dB (-p->peaks[c][x].max));
1141 if (p->peaks[c][x].min > 0) {
1142 pmin = alt_log_meter (fast_coefficient_to_dB (p->peaks[c][x].min));
1144 pmin = -alt_log_meter (fast_coefficient_to_dB (-p->peaks[c][x].min));
1146 cr->move_to (m_l + x - .5, height_2 - height_2 * pmax);
1147 cr->line_to (m_l + x - .5, height_2 - height_2 * pmin);
1151 clip_top = height_2 - height_2 * dB_to_coefficient (-1);
1152 clip_bot = height_2 + height_2 * dB_to_coefficient (-1);
1153 for (size_t x = 0 ; x < width; ++x) {
1154 cr->move_to (m_l + x - .5, height_2 - height_2 * p->peaks[c][x].max);
1155 cr->line_to (m_l + x - .5, height_2 - height_2 * p->peaks[c][x].min);
1162 cr->set_source_rgba (1.0, 0, 0, 1.0);
1163 for (size_t x = 0 ; x < width; ++x) {
1164 if (p->peaks[c][x].max >= 1.0) {
1165 cr->move_to (m_l + x - .5, 0);
1166 cr->line_to (m_l + x - .5, clip_top);
1168 if (p->peaks[c][x].min <= -1.0) {
1169 cr->move_to (m_l + x - .5, clip_bot);
1170 cr->line_to (m_l + x - .5, ht);
1175 // >= -1dBTP (coeff >= .89125, libs/vamp-plugins/TruePeak.cpp)
1176 cr->set_source_rgba (1.0, 0.7, 0, 0.7);
1177 for (std::set<samplepos_t>::const_iterator i = p->truepeakpos[c].begin (); i != p->truepeakpos[c].end (); ++i) {
1178 cr->move_to (m_l + (*i) - .5, clip_top);
1179 cr->line_to (m_l + (*i) - .5, clip_bot);
1185 cr->set_source_rgba (.3, .3, .3, 0.7);
1186 cr->move_to (m_l + 0, height_2 - .5);
1187 cr->line_to (m_l + width, height_2 - .5);
1192 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
1193 layout->set_alignment (Pango::ALIGN_LEFT);
1194 layout->set_text (_("dBFS"));
1195 layout->get_pixel_size (w, h);
1196 cr->move_to (rint (m_l - h - anw - 10), rint (height_2 + w * .5));
1197 cr->set_source_rgba (.9, .9, .9, 1.0);
1199 cr->rotate (M_PI / -2.0);
1200 layout->show_in_cairo_context (cr);
1204 cr->set_line_width (1.0);
1205 cr->set_dash (dashes, 2.0);
1206 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
1208 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
1212 XAXISLABEL ((ht - ht * alt_log_meter (-36)), _("-36"));
1213 XAXISLABEL ((ht - ht * alt_log_meter (-18)), _("-18"));
1214 XAXISLABEL ((ht - ht * alt_log_meter (-9)), _("-9"));
1215 XAXISLABEL ((ht - ht * alt_log_meter (-3)), _("-3"));
1217 XAXISLABEL ((ht - ht * .1259), _("-18"));
1218 XAXISLABEL ((ht - ht * .3548), _("-9"));
1219 XAXISLABEL ((ht - ht * .7079), _("-3"));
1223 XAXISLABEL ((height_2 - height_2 * alt_log_meter (-18)), _("-18"));
1224 XAXISLABEL ((height_2 - height_2 * alt_log_meter (-9)), _("-9"));
1225 XAXISLABEL ((height_2 - height_2 * alt_log_meter (-3)), _("-3"));
1226 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-18)), _("-18"));
1227 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-9)), _("-9"));
1228 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-3)), _("-3"));
1230 XAXISLABEL (height_2 * 0.6452, _("-9"));
1231 XAXISLABEL (height_2 * 1.3548, _("-9"));
1232 XAXISLABEL (height_2 * 0.2921, _("-3"));
1233 XAXISLABEL (height_2 * 1.7079, _("-3"));