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"
29 #include "gtkmm2ext/utils.h"
30 #include "gtkmm2ext/colors.h"
32 #include "audiographer/general/analyser.h"
34 #include "ardour/audiofilesource.h"
35 #include "ardour/audioregion.h"
36 #include "ardour/auditioner.h"
37 #include "ardour/dB.h"
38 #include "ardour/logmeter.h"
39 #include "ardour/region_factory.h"
40 #include "ardour/session.h"
41 #include "ardour/smf_source.h"
42 #include "ardour/source_factory.h"
43 #include "ardour/srcfilesource.h"
44 #include "ardour/utils.h"
46 #include "audio_clock.h"
47 #include "export_report.h"
48 #include "ui_config.h"
53 using namespace ARDOUR;
55 ExportReport::ExportReport (Session* session, StatusPtr s)
56 : ArdourDialog (_("Export Report/Analysis"))
63 init (s->result_map, true);
66 ExportReport::ExportReport (const std::string & title, const AnalysisResults & ar)
67 : ArdourDialog (title)
78 ExportReport::init (const AnalysisResults & ar, bool with_file)
80 set_resizable (false);
81 pages.set_scrollable ();
83 std::vector<double> dashes;
84 dashes.push_back (3.0);
85 dashes.push_back (5.0);
88 for (AnalysisResults::const_iterator i = ar.begin (); i != ar.end (); ++i, ++page) {
90 VBox *vb = manage (new VBox ());
91 Table *t = manage (new Table (4, 4));
92 Table *wtbl = manage (new Table (3, 2));
94 t->set_border_width (0);
96 wtbl->set_spacings (4);
98 vb->set_border_width (4);
99 vb->pack_start (*t, false, false, 2);
100 vb->pack_start (*wtbl, false, false, 2);
102 std::string path = i->first;
103 ExportAnalysisPtr p = i->second;
105 std::list<CimgPlayheadArea*> playhead_widgets;
108 l = manage (new Label (_("File:"), ALIGN_END));
109 t->attach (*l, 0, 1, 0, 1);
110 l = manage (new Label ());
111 l->set_ellipsize (Pango::ELLIPSIZE_START);
112 l->set_width_chars (48);
113 l->set_max_width_chars (48);
115 l->set_alignment (ALIGN_START, ALIGN_CENTER);
116 t->attach (*l, 1, 3, 0, 1, FILL, SHRINK);
118 Button *b = manage (new Button (_("Open Folder")));
119 t->attach (*b, 3, 4, 0, 2, FILL, SHRINK);
120 b->signal_clicked ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::open_folder), path));
126 samplecnt_t file_length = 0;
127 samplecnt_t sample_rate = 0;
128 samplecnt_t start_off = 0;
129 unsigned int channels = 0;
130 std::string file_fmt;
132 if (with_file && AudioFileSource::get_soundfile_info (path, info, errmsg)) {
135 file_length = info.length;
136 sample_rate = info.samplerate;
137 start_off = info.timecode;
138 channels = info.channels;
140 files.insert (std::make_pair (page, AuditionInfo (path, channels)));
142 /* File Info Table */
144 samplecnt_t const nfr = _session ? _session->nominal_sample_rate () : 25;
145 double src_coef = (double) nfr / info.samplerate;
147 l = manage (new Label (_("Format:"), ALIGN_END));
148 t->attach (*l, 0, 1, 1, 2);
149 file_fmt = info.format_name;
150 std::replace (file_fmt.begin (), file_fmt.end (), '\n', ' ');
151 l = manage (new Label ());
152 l->set_ellipsize (Pango::ELLIPSIZE_START);
153 l->set_width_chars (48);
154 l->set_max_width_chars (48);
155 l->set_text (file_fmt);
156 l->set_alignment (ALIGN_START, ALIGN_CENTER);
157 t->attach (*l, 1, 3, 1, 2, FILL, SHRINK);
159 l = manage (new Label (_("Channels:"), ALIGN_END));
160 t->attach (*l, 0, 1, 2, 3);
161 l = manage (new Label (string_compose ("%1", info.channels), ALIGN_START));
162 t->attach (*l, 1, 2, 2, 3);
164 l = manage (new Label (_("Sample rate:"), ALIGN_END));
165 t->attach (*l, 0, 1, 3, 4);
166 l = manage (new Label (string_compose (_("%1 Hz"), info.samplerate), ALIGN_START));
167 t->attach (*l, 1, 2, 3, 4);
169 l = manage (new Label (_("Duration:"), ALIGN_END));
170 t->attach (*l, 2, 3, 2, 3);
171 clock = manage (new AudioClock ("sfboxLengthClock", true, "", false, false, true, false));
172 clock->set_session (_session);
173 clock->set_mode (AudioClock::MinSec);
174 clock->set (info.length * src_coef + 0.5, true);
175 t->attach (*clock, 3, 4, 2, 3);
177 l = manage (new Label (_("Timecode:"), ALIGN_END));
178 t->attach (*l, 2, 3, 3, 4);
179 clock = manage (new AudioClock ("sfboxTimecodeClock", true, "", false, false, false, false));
180 clock->set_session (_session);
181 clock->set_mode (AudioClock::Timecode);
182 clock->set (info.timecode * src_coef + 0.5, true);
183 t->attach (*clock, 3, 4, 3, 4);
184 } else if (with_file) {
186 /* Note: errmsg can have size = 1, and contain "\0\0" */
187 if (!errmsg.empty() && 0 != strlen(errmsg.c_str())) {
188 l = manage (new Label (_("Error:"), ALIGN_END));
189 t->attach (*l, 0, 1, 1, 2);
190 l = manage (new Label (errmsg, ALIGN_START));
191 t->attach (*l, 1, 4, 1, 2);
196 Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (get_pango_context ());
198 // calc geometry of numerics
199 const float dbfs = accurate_coefficient_to_dB (p->peak);
200 const float dbtp = accurate_coefficient_to_dB (p->truepeak);
202 #define TXTSIZE(LINE, TXT, FONT) { \
203 layout->set_font_description (UIConfiguration::instance ().FONT ()); \
204 layout->set_text (TXT); \
205 layout->get_pixel_size (w, h); \
206 if (w > mnw) { mnw = w; } \
207 if (h > lin[LINE]) { lin[LINE] = h; } \
210 #define TXTWIDTH(TXT, FONT) { \
211 layout->set_font_description (UIConfiguration::instance ().FONT ()); \
212 layout->set_text (TXT); \
213 layout->get_pixel_size (w, h); \
214 if (w > mml) { mml = w; } \
217 int m_r = 0; // right side
218 int mnh = 0; // mono height
219 int mnw = 0; // max numeric width
220 int anw = 0; // spectrum annotation text width
222 int lin[6] = { 0, 0, 0, 0, 0, 0 }; // max line height
224 TXTSIZE(0, _("(too short integration time)"), get_SmallFont);
226 TXTSIZE(0, _("-888"), get_SmallMonospaceFont);
231 TXTSIZE(0, _("Peak:"), get_SmallFont);
232 TXTSIZE(1, string_compose (_("%1 dBFS"), std::setprecision (1), std::fixed, dbfs), get_LargeFont);
233 TXTSIZE(2, _("True Peak:"), get_SmallFont);
234 TXTSIZE(3, string_compose (_("%1 dBTP"), std::setprecision (1), std::fixed, dbtp), get_LargeFont);
235 TXTSIZE(4, _("Normalization Gain:"), get_SmallFont);
236 TXTSIZE(5, _("+888.88 dB"), get_SmallMonospaceFont);
238 TXTSIZE(0, _("Integrated Loudness:"), get_SmallFont);
239 TXTSIZE(1, string_compose (_("%1 LUFS"), std::setprecision (1), std::fixed, p->loudness), get_LargeFont);
240 TXTSIZE(2, _("Loudness Range:"), get_SmallFont);
241 TXTSIZE(3, string_compose (_("%1 LU"), std::setprecision (1), std::fixed, p->loudness_range), get_LargeFont);
244 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];
245 const int hh = std::max (100, ht + 12);
246 const int htn = lin[0] * 1.25 + lin[1] * 1.25 + lin[2] * 1.25 + lin[3];
247 int m_l = 2 * mnw + /*hist-width*/ 540 + /*box spacing*/ 8 - /*peak-width*/ 800 - m_r; // margin left
249 int mml = 0; // min margin left -- ensure left margin is wide enough
250 TXTWIDTH (_("Time"), get_SmallFont);
251 TXTWIDTH (_("100"), get_SmallMonospaceFont);
252 m_l = (std::max(anw + mnh + 14, std::max (m_l, mml + 8)) + 3) & ~3;
254 mnw = (m_l - /*hist-width*/ 540 - /*box spacing*/ 8 + /*peak-width*/ 800 + m_r) / 2;
255 const int nw2 = mnw / 2; // nums, horizontal center
259 y0[0] = (hh - ht) * .5;
261 y0[0] = (hh - htn) * .5;
263 y0[1] = y0[0] + lin[0] * 1.25;
264 y0[2] = y0[1] + lin[1] * 1.25;
265 y0[3] = y0[2] + lin[2] * 1.25;
266 y0[4] = y0[3] + lin[3] * 1.25;
267 y0[5] = y0[4] + lin[4] * 1.25;
269 /* calc heights & alignment of png-image */
270 const float specth = sizeof (p->spectrum[0]) / sizeof (float);
271 const float waveh2 = std::min (100, 8 * lin[0] / (int) p->n_channels);
273 Cairo::RefPtr<Cairo::ImageSurface> png_surface;
277 if (with_file && UIConfiguration::instance().get_save_export_analysis_image ()) { /*png image */
278 const int top_w = 540 + 2 * (mnw + 4); // 4px spacing
279 const int wav_w = m_l + m_r + 4 + sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
280 const int spc_w = m_l + m_r + 4 + sizeof (p->spectrum) / sizeof (float) / specth;
284 if (channels > 0 && file_length > 0 && sample_rate > 0) {
285 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
286 layout->set_text (_("00:00:00.000"));
287 layout->get_pixel_size (w, h);
288 int height = h * 1.75;
289 ann_h = 4 + height /* Time Axis */;
291 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
292 layout->set_text (_("0|A8"));
293 layout->get_pixel_size (w, h);
295 ann_h += 4 + 3 * linesp; /* File Info */;
298 const int png_h = hh + 4 + p->n_channels * (2 * waveh2 + 4) + ann_h + specth + 4;
299 png_w = std::max (std::max (top_w, wav_w), spc_w);
301 png_surface = Cairo::ImageSurface::create (Cairo::FORMAT_RGB24, png_w, png_h);
302 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
303 pcx->set_source_rgb (.2, .2, .2);
306 if (channels > 0 && file_length > 0 && sample_rate > 0) {
308 // Add file-name, format, duration, sample-rate & timecode
309 pcx->set_source_rgb (.7, .7, .7);
310 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
311 layout->set_alignment (Pango::ALIGN_LEFT);
313 #define IMGLABEL(X0, STR, VAL) { \
314 layout->set_text (STR); \
315 pcx->move_to (X0, png_y0); \
316 layout->get_pixel_size (w, h); \
317 layout->show_in_cairo_context (pcx); \
318 layout->set_text (VAL); \
319 pcx->move_to (X0 + w + 2, png_y0); \
320 layout->show_in_cairo_context (pcx); \
323 // TODO get max width of labels per column, right-align labels, x-align 1/3, 2/3 columns
325 const int lx1 = m_l + png_w * 2 / 3; // right-col is short (channels, SR, duration)
326 std::string sha1sum = ARDOUR::compute_sha1_of_file (path);
327 if (!sha1sum.empty()) {
328 sha1sum = " (sha1: " + sha1sum + ")";
331 IMGLABEL (lx0, _("File:"), Glib::path_get_basename (path) + sha1sum);
332 IMGLABEL (lx1, _("Channels:"), string_compose ("%1", channels));
335 IMGLABEL (lx0, _("Format:"), file_fmt);
336 IMGLABEL (lx1, _("Sample rate:"), string_compose (_("%1 Hz"), sample_rate));
341 _session->sample_to_timecode (start_off, tct, false, false);
342 IMGLABEL (lx0, _("Timecode:"), Timecode::timecode_format_time (tct));
344 IMGLABEL (lx1, _("Duration:"), Timecode::timecode_format_sampletime (file_length, sample_rate, 1000, false));
349 { /* peak, loudness and R128 histogram */
350 Cairo::RefPtr<Cairo::ImageSurface> nums = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, mnw, hh);
351 Cairo::RefPtr<Cairo::ImageSurface> ebur = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, mnw, hh);
352 Cairo::RefPtr<Cairo::ImageSurface> hist = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, 540, hh);
354 /* peak and true-peak numerics */
355 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (nums);
356 cr->set_source_rgba (0, 0, 0, 1.0);
359 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
360 layout->set_alignment (Pango::ALIGN_LEFT);
361 layout->set_text (_("Peak:"));
362 layout->get_pixel_size (w, h);
363 cr->move_to (rint (nw2 - w * .5), y0[0]);
364 cr->set_source_rgba (.7, .7, .7, 1.0);
365 layout->show_in_cairo_context (cr);
367 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
368 layout->set_text (string_compose (_("%1 dBFS"), std::setprecision (1), std::fixed, dbfs));
369 layout->get_pixel_size (w, h);
370 cr->move_to (rint (nw2 - w * .5), y0[1]);
371 if (dbfs >= 0.f) { cr->set_source_rgba (1.0, .1, .1, 1.0); }
372 else if (dbfs > -1.f) { cr->set_source_rgba (1.0, .7, .0, 1.0); }
373 layout->show_in_cairo_context (cr);
376 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
377 layout->set_text (_("True Peak:"));
378 layout->get_pixel_size (w, h);
379 cr->move_to (rint (nw2 - w * .5), y0[2]);
380 cr->set_source_rgba (.7, .7, .7, 1.0);
381 layout->show_in_cairo_context (cr);
383 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
384 layout->set_text (string_compose (_("%1 dBTP"), std::setprecision (1), std::fixed, dbtp));
385 layout->get_pixel_size (w, h);
386 cr->move_to (rint (nw2 - w * .5), y0[3]);
387 if (dbtp >= 0.f) { cr->set_source_rgba (1.0, .1, .1, 1.0); }
388 else if (dbtp > -1.f) { cr->set_source_rgba (1.0, .7, .0, 1.0); }
389 layout->show_in_cairo_context (cr);
393 const float ndb = accurate_coefficient_to_dB (p->norm_gain_factor);
394 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
395 layout->set_text (_("Normalization Gain:"));
396 layout->get_pixel_size (w, h);
397 cr->move_to (rint (nw2 - w * .5), y0[4]);
398 cr->set_source_rgba (.7, .7, .7, 1.0);
399 layout->show_in_cairo_context (cr);
401 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
402 layout->set_text (string_compose (_("%1 dB"), std::setprecision (2), std::showpos, std::fixed, ndb));
404 layout->get_pixel_size (w, h);
405 cr->move_to (rint (nw2 - w * .5), y0[5]);
406 // TODO tweak thresholds
407 if (p->norm_gain_factor < 1.0) {
408 cr->set_source_rgba (1.0, .7, .1, 1.0);
409 } else if (p->norm_gain_factor == 1.0) {
410 cr->set_source_rgba (.7, .7, .7, 1.0);
411 } else if (fabsf (ndb) < 12) {
412 cr->set_source_rgba (.1, 1.0, .1, 1.0);
413 } else if (fabsf (ndb) < 18) {
414 cr->set_source_rgba (1.0, .7, .1, 1.0);
416 cr->set_source_rgba (1.0, .1, .1, 1.0);
418 layout->show_in_cairo_context (cr);
423 /* EBU R128 numerics */
424 cr = Cairo::Context::create (ebur);
425 cr->set_source_rgba (0, 0, 0, 1.0);
428 cr->set_source_rgba (.7, .7, .7, 1.0);
430 if (!i->second->have_loudness) {
431 layout->set_alignment (Pango::ALIGN_CENTER);
432 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
433 layout->set_text (_("Not\nAvailable"));
434 layout->get_pixel_size (w, h);
435 cr->move_to (rint (nw2 - w * .5), rint ((hh - h) * .5));
436 layout->show_in_cairo_context (cr);
438 else if (p->loudness == -200 && p->loudness_range == 0) {
439 layout->set_alignment (Pango::ALIGN_CENTER);
440 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
441 layout->set_text (_("Not\nAvailable"));
442 layout->get_pixel_size (w, h);
443 cr->move_to (rint (nw2 - w * .5), rint (hh * .5 - h * .66));
444 layout->show_in_cairo_context (cr);
447 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
448 layout->set_text (_("(too short integration time)"));
449 layout->get_pixel_size (w, h);
450 cr->move_to (rint (nw2 - w * .5), rint (hh * .5 + yy));
451 layout->show_in_cairo_context (cr);
454 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
455 layout->set_alignment (Pango::ALIGN_LEFT);
456 layout->set_text (_("Integrated Loudness:"));
457 layout->get_pixel_size (w, h);
458 cr->move_to (rint (nw2 - w * .5), y0[0]);
459 layout->show_in_cairo_context (cr);
461 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
462 layout->set_text (string_compose (_("%1 LUFS"), std::setprecision (1), std::fixed, p->loudness));
463 layout->get_pixel_size (w, h);
464 cr->move_to (rint (nw2 - w * .5), y0[1]);
465 layout->show_in_cairo_context (cr);
467 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
468 layout->set_text (_("Loudness Range:"));
469 layout->get_pixel_size (w, h);
470 cr->move_to (rint (nw2 - w * .5), y0[2]);
471 layout->show_in_cairo_context (cr);
473 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
474 layout->set_text (string_compose (_("%1 LU"), std::setprecision (1), std::fixed, p->loudness_range));
475 layout->get_pixel_size (w, h);
476 cr->move_to (rint (nw2 - w * .5), y0[3]);
477 layout->show_in_cairo_context (cr);
481 /* draw loudness histogram */
482 cr = Cairo::Context::create (hist);
483 cr->set_source_rgba (0, 0, 0, 1.0);
486 cr->set_source_rgba (.7, .7, .7, 1.0);
487 cr->set_line_width (1.0);
489 if (p->loudness_hist_max > 0 && i->second->have_loudness) {
491 for (size_t x = 0 ; x < 510; ++x) {
492 cr->move_to (x - .5, hh);
493 cr->line_to (x - .5, (float) hh * (1.0 - p->loudness_hist[x] / (float) p->loudness_hist_max));
497 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
498 layout->set_alignment (Pango::ALIGN_CENTER);
501 layout->set_text (_("LUFS\n(short)"));
502 layout->get_pixel_size (w, h);
503 Gtkmm2ext::rounded_rectangle (cr, 5, 5, w + 2, h + 2, 4);
504 cr->set_source_rgba (.1, .1, .1, 0.7);
507 cr->set_source_rgba (.9, .9, .9, 1.0);
508 layout->show_in_cairo_context (cr);
511 layout->set_text (_("Multiplicity"));
512 layout->get_pixel_size (w, h);
513 Gtkmm2ext::rounded_rectangle (cr, 5, hh - w - 3, h + 2, w + 2, 4);
514 cr->set_source_rgba (.1, .1, .1, 0.7);
517 cr->move_to (6, hh - 2);
518 cr->set_source_rgba (.9, .9, .9, 1.0);
519 cr->rotate (M_PI / -2.0);
520 layout->show_in_cairo_context (cr);
524 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
525 layout->set_alignment (Pango::ALIGN_LEFT);
526 for (int g = -53; g <= -8; g += 5) {
527 // grid-lines. [110] -59LUFS .. [650]: -5 LUFS
528 layout->set_text (string_compose ("%1", std::setw(3), std::setfill(' '), g));
529 layout->get_pixel_size (w, h);
531 cr->set_operator (Cairo::OPERATOR_OVER);
532 Gtkmm2ext::rounded_rectangle (cr,
533 rint ((g + 59.0) * 10.0 - h * .5), 5,
535 const float pk = (g + 59.0) / 54.0;
536 Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, .3 + pk * .4, .6);
537 Gtkmm2ext::set_source_rgba (cr, c);
541 cr->set_source_rgba (.9, .9, .9, 1.0);
542 cr->move_to (rint ((g + 59.0) * 10.0 - h * .5), w + 6.0);
543 cr->rotate (M_PI / -2.0);
544 layout->show_in_cairo_context (cr);
547 cr->set_operator (Cairo::OPERATOR_ADD);
549 cr->set_source_rgba (.3, .3, .3, 1.0);
550 cr->set_dash (dashes, 1.0);
551 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
552 cr->move_to (rint ((g + 59.0) * 10.0) + .5, w + 8.0);
553 cr->line_to (rint ((g + 59.0) * 10.0) + .5, hh);
559 layout->set_alignment (Pango::ALIGN_CENTER);
560 layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
561 layout->set_text (_("Not\nAvailable"));
562 layout->get_pixel_size (w, h);
563 cr->move_to (rint ((510 - w) * .5), rint ((hh - h) * .5));
564 layout->show_in_cairo_context (cr);
570 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
571 pcx->set_source (nums, 0, png_y0);
573 pcx->set_source (hist, (png_w - 540) / 2, png_y0);
575 pcx->set_source (ebur, png_w - mnw, png_y0);
580 CimgArea *nu = manage (new CimgArea (nums));
581 CimgArea *eb = manage (new CimgArea (ebur));
582 CimgArea *hi = manage (new CimgArea (hist));
583 HBox *hb = manage (new HBox ());
585 hb->pack_start (*nu, false, false);
586 hb->pack_start (*hi, false, false);
587 hb->pack_start (*eb, false, false);
589 wtbl->attach (*hb, 0, 2, wrow, wrow + 1, SHRINK, SHRINK);
593 #define XAXISLABEL(POS, TXT) { \
594 const float yy = rint (POS); \
595 layout->set_text (TXT); \
596 layout->get_pixel_size (w, h); \
597 cr->move_to (m_l - 8 - w, rint ((POS) - h * .5)); \
598 cr->set_source_rgba (.9, .9, .9, 1.0); \
599 cr->set_operator (Cairo::OPERATOR_OVER); \
600 layout->show_in_cairo_context (cr); \
601 cr->move_to (m_l - 4, yy - .5); \
602 cr->line_to (m_l + width, yy - .5); \
603 cr->set_source_rgba (.3, .3, .3, 1.0); \
604 cr->set_operator (Cairo::OPERATOR_ADD); \
610 VBox *lrb = manage (new VBox());
611 ToggleButton *log = manage (new ToggleButton (S_("Logscale|Lg")));
612 ToggleButton *rec = manage (new ToggleButton (S_("Rectified|Rf")));
613 Gtkmm2ext::UI::instance()->set_tip (log, _("Logscale"));
614 Gtkmm2ext::UI::instance()->set_tip (rec, _("Rectified"));
616 lrb->pack_start (*log, false, false, 5);
617 lrb->pack_end (*rec, false, false, 5);
618 log->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_logscale_toggled), log));
619 rec->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_rectivied_toggled), rec));
621 wtbl->attach (*lrb, 1, 2, wrow, wrow + p->n_channels, SHRINK, SHRINK);
624 for (uint32_t c = 0; c < p->n_channels; ++c) {
626 const size_t width = sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
628 Cairo::RefPtr<Cairo::ImageSurface> wave;
629 Cairo::RefPtr<Cairo::ImageSurface> wave_log;
630 Cairo::RefPtr<Cairo::ImageSurface> wave_rect;
631 Cairo::RefPtr<Cairo::ImageSurface> wave_lr;
632 draw_waveform(wave, p, c, m_l, width, anw, waveh2, false, false);
633 draw_waveform(wave_log, p, c, m_l, width, anw, waveh2, true, false);
634 draw_waveform(wave_rect, p, c, m_l, width, anw, waveh2, false, true);
635 draw_waveform(wave_lr, p, c, m_l, width, anw, waveh2, true, true);
637 CimgWaveArea *wv = manage (new CimgWaveArea (wave, wave_log, wave_rect, wave_lr, m_l, width));
639 playhead_widgets.push_back (wv);
640 waves.push_back (wv);
641 wv->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
642 wtbl->attach (*wv, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
646 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
647 pcx->set_source (wave, 0, png_y0);
649 png_y0 += 2 * waveh2 + 4;
653 if (channels > 0 && file_length > 0 && sample_rate > 0)
655 /* Time Axis -- re-use waveform width */
656 const size_t width = sizeof (p->peaks) / sizeof (ARDOUR::PeakData::PeakDatum) / 4;
657 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
658 layout->set_text (_("00:00:00.000"));
659 layout->get_pixel_size (w, h);
660 int height = h * 1.75;
661 Cairo::RefPtr<Cairo::ImageSurface> ytme = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, height);
662 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (ytme);
663 cr->set_operator (Cairo::OPERATOR_SOURCE);
664 cr->set_source_rgba (0, 0, 0, 1.0);
666 cr->rectangle (0, 0, m_l, height);
667 cr->set_source_rgba (0, 0, 0, 0);
669 cr->set_operator (Cairo::OPERATOR_OVER);
671 cr->set_line_width (1.0);
672 for (int i = 0; i <= 4; ++i) {
673 const float fract = (float) i / 4.0;
674 // " XX:XX:XX.XXX" [space/minus] 12 chars = 13.
675 const float xalign = (i == 4) ? 1.0 : (i == 0) ? 1.0 / 13.0 : 7.0 / 13.0;
678 AudioClock::print_minsec (start_off + file_length * fract,
679 buf, sizeof (buf), sample_rate);
681 layout->set_text (buf);
682 layout->get_pixel_size (w, h);
683 cr->move_to (rint (m_l + width * fract - w * xalign), rint (.5 * (height - h)));
684 cr->set_source_rgba (.9, .9, .9, 1.0);
685 layout->show_in_cairo_context (cr);
687 cr->set_source_rgba (.7, .7, .7, 1.0);
688 cr->move_to (rint (m_l + width * fract) - .5, 0);
689 cr->line_to (rint (m_l + width * fract) - .5, ceil (height * .15));
690 cr->move_to (rint (m_l + width * fract) - .5, floor (height * .85));
691 cr->line_to (rint (m_l + width * fract) - .5, height);
695 layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
696 layout->set_text (_("Time"));
697 cr->set_source_rgba (.9, .9, .9, 1.0);
698 layout->get_pixel_size (w, h);
699 cr->move_to (rint (m_l - w - 8), rint (.5 * (height - h)));
700 layout->show_in_cairo_context (cr);
703 CimgPlayheadArea *tm = manage (new CimgPlayheadArea (ytme, m_l, width, true));
704 playhead_widgets.push_back (tm);
705 tm->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
706 wtbl->attach (*tm, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
710 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
711 pcx->set_source (ytme, 0, png_y0);
713 png_y0 += height + 4;
719 const size_t height = specth;
720 const size_t swh = sizeof (p->spectrum) / sizeof (float);
721 const size_t width = swh / height;
723 Cairo::RefPtr<Cairo::ImageSurface> spec = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, height);
724 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (spec);
725 cr->set_operator (Cairo::OPERATOR_SOURCE);
726 cr->rectangle (0, 0, m_l, height);
727 cr->set_source_rgba (0, 0, 0, 0);
729 cr->rectangle (m_l, 0, width, height);
730 cr->set_source_rgba (0, 0, 0, 1.0);
732 cr->set_operator (Cairo::OPERATOR_OVER);
734 for (size_t x = 0 ; x < width; ++x) {
735 for (size_t y = 0 ; y < height; ++y) {
736 const float pk = p->spectrum[x][y];
737 Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
738 Gtkmm2ext::set_source_rgba (cr, c);
739 cr->rectangle (m_l + x - .5, y - .5, 1, 1);
745 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
746 layout->set_text (_("Hz"));
747 layout->get_pixel_size (w, h);
748 cr->move_to (rint (m_l - h - anw - 10), rint ((height + w) * .5));
749 cr->set_source_rgba (.9, .9, .9, 1.0);
751 cr->rotate (M_PI / -2.0);
752 layout->show_in_cairo_context (cr);
756 cr->set_line_width (1.0);
757 cr->set_dash (dashes, 2.0);
758 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
760 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
761 //XAXISLABEL (p->freq[0], _("50Hz"));
762 XAXISLABEL (p->freq[1], _("100"));
763 XAXISLABEL (p->freq[2], _("500"));
764 XAXISLABEL (p->freq[3], _("1K"));
765 XAXISLABEL (p->freq[4], _("5K"));
766 XAXISLABEL (p->freq[5], _("10K"));
770 Cairo::RefPtr<Cairo::ImageSurface> scale = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_r, height);
771 cr = Cairo::Context::create (scale);
772 cr->set_operator (Cairo::OPERATOR_SOURCE);
773 cr->rectangle (0, 0, m_r, height);
774 cr->set_source_rgba (0, 0, 0, 0);
777 cr->set_operator (Cairo::OPERATOR_OVER);
778 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
779 layout->set_alignment (Pango::ALIGN_LEFT);
780 layout->set_text (_("dBFS"));
781 layout->get_pixel_size (w, h);
782 cr->move_to (rint (.5 * (m_r - w)), height - h - 2);
783 cr->set_source_rgba (.9, .9, .9, 1.0);
784 layout->show_in_cairo_context (cr);
786 int innertop = ceil (mnh * .5) + 1;
787 size_t innerheight = (height - 2 * innertop - h - 2);
789 cr->rectangle (1, innertop - 1, m_r - 2 - anw, innerheight + 2);
790 cr->set_source_rgba (0, 0, 0, 1.0);
791 cr->fill_preserve ();
792 cr->set_line_width (1.0);
793 cr->set_source_rgba (.7, .7, .6, 1.0);
796 for (size_t y = 0 ; y < innerheight - 2; ++y) {
797 const float pk = 1.0 - (float) y / innerheight;
798 Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
799 Gtkmm2ext::set_source_rgba (cr, c);
800 cr->rectangle (2, innertop + y + .5, m_r - 4 - anw, 1);
804 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
805 for (int i = 0; i <= 4; ++i) {
806 const float fract = (float) i / 4.0;
807 const float yalign = .5; // (i == 4) ? 0 : (i == 0) ? 1.0 : .5;
809 snprintf (buf, sizeof (buf), "%.0f", AudioGrapher::Analyser::fft_range_db * -fract);
810 layout->set_text (buf);
811 layout->get_pixel_size (w, h);
813 cr->move_to (m_r - anw, rint (innertop + fract * innerheight - h * yalign));
814 cr->set_source_rgba (.9, .9, .9, 1.0);
815 layout->show_in_cairo_context (cr);
819 CimgPlayheadArea *sp = manage (new CimgPlayheadArea (spec, m_l, width));
820 playhead_widgets.push_back (sp);
821 sp->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
822 CimgArea *an = manage (new CimgArea (scale));
823 wtbl->attach (*sp, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
824 wtbl->attach (*an, 1, 2, wrow, wrow + 1, SHRINK, SHRINK);
828 Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
829 pcx->set_source (spec, 0, png_y0);
831 pcx->set_source (scale, png_w - m_r, png_y0);
836 timeline[page] = playhead_widgets;
838 HBox *tab = manage (new HBox ());
839 l = manage (new Label (Glib::path_get_basename (path)));
840 Gtk::Image *img = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_MENU));
841 tab->pack_start (*img);
842 tab->pack_start (*l);
846 pages.pages ().push_back (Notebook_Helpers::TabElem (*vb, *tab));
847 pages.signal_switch_page().connect (sigc::mem_fun (*this, &ExportReport::on_switch_page));
850 assert (with_file && !path.empty ());
851 std::string imgpath = Glib::build_filename (Glib::path_get_dirname (path), PBD::basename_nosuffix (path) + ".png");
852 PBD::info << string_compose(_("Writing Export Analysis Image: %1."), imgpath) << endmsg;
853 png_surface->write_to_png (imgpath);
857 pages.set_show_tabs (true);
859 pages.set_name ("ExportReportNotebook");
860 pages.set_current_page (0);
862 get_vbox ()->set_spacing (4);
863 get_vbox ()->pack_start (pages, false, false);
866 _session->AuditionActive.connect(auditioner_connections, invalidator (*this), boost::bind (&ExportReport::audition_active, this, _1), gui_context());
867 _session->the_auditioner()->AuditionProgress.connect(auditioner_connections, invalidator (*this), boost::bind (&ExportReport::audition_progress, this, _1, _2), gui_context());
870 if (_session && with_file) {
871 play_btn = add_button (Stock::MEDIA_PLAY, RESPONSE_ACCEPT);
872 stop_btn = add_button (Stock::MEDIA_STOP, RESPONSE_ACCEPT);
874 add_button (Stock::CLOSE, RESPONSE_CLOSE);
876 set_default_response (RESPONSE_CLOSE);
877 if (_session && with_file) {
878 stop_btn->signal_clicked().connect (sigc::mem_fun (*this, &ExportReport::stop_audition));
879 play_btn->signal_clicked().connect (sigc::mem_fun (*this, &ExportReport::play_audition));
880 stop_btn->set_sensitive (false);
889 int i = ArdourDialog::run ();
890 if (i == Gtk::RESPONSE_DELETE_EVENT || i == RESPONSE_CLOSE) {
896 _session->cancel_audition();
898 return RESPONSE_CLOSE;
902 ExportReport::open_folder (std::string p)
904 PBD::open_folder (Glib::path_get_dirname(p));
908 ExportReport::audition_active (bool active)
910 if (!stop_btn || !play_btn) {
913 stop_btn->set_sensitive (active);
914 play_btn->set_sensitive (!active);
916 if (!active && _audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
917 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
918 i != timeline[_audition_num].end();
920 (*i)->set_playhead (-1);
924 if (_audition_num >= 0 ) {
925 Widget *page = pages.get_nth_page (_audition_num);
926 HBox *box = static_cast<Gtk::HBox*> (pages.get_tab_label (*page));
928 (*(box->get_children().begin()))->hide ();
930 (*(box->get_children().begin()))->show ();
940 ExportReport::audition (std::string path, unsigned n_chn, int page)
943 _session->cancel_audition();
945 if (n_chn ==0) { return; }
947 /* can't really happen, unless the user replaces the file while the dialog is open.. */
948 if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
949 PBD::warning << string_compose(_("Could not read file: %1 (%2)."), path, strerror(errno)) << endmsg;
952 if (SMFSource::valid_midi_file (path)) { return; }
954 boost::shared_ptr<Region> r;
956 boost::shared_ptr<AudioFileSource> afs;
957 bool old_sbp = AudioSource::get_build_peakfiles ();
959 /* don't even think of building peakfiles for these files */
960 AudioSource::set_build_peakfiles (false);
962 for (unsigned int n = 0; n < n_chn; ++n) {
964 afs = boost::dynamic_pointer_cast<AudioFileSource> (
965 SourceFactory::createExternal (DataType::AUDIO, *_session,
967 Source::Flag (ARDOUR::AudioFileSource::NoPeakFile), false));
968 if (afs->sample_rate() != _session->nominal_sample_rate()) {
969 boost::shared_ptr<SrcFileSource> sfs (new SrcFileSource(*_session, afs, ARDOUR::SrcGood));
970 srclist.push_back(sfs);
972 srclist.push_back(afs);
974 } catch (failed_constructor& err) {
975 PBD::error << _("Could not access soundfile: ") << path << endmsg;
976 AudioSource::set_build_peakfiles (old_sbp);
981 AudioSource::set_build_peakfiles (old_sbp);
983 if (srclist.empty()) {
987 afs = boost::dynamic_pointer_cast<AudioFileSource> (srclist[0]);
988 std::string rname = region_name_from_path (afs->path(), false);
990 PBD::PropertyList plist;
992 plist.add (ARDOUR::Properties::start, 0);
993 plist.add (ARDOUR::Properties::length, srclist[0]->length(srclist[0]->timeline_position()));
994 plist.add (ARDOUR::Properties::name, rname);
995 plist.add (ARDOUR::Properties::layer, 0);
997 r = boost::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (srclist, plist, false));
1000 _session->audition_region(r);
1001 _audition_num = page;
1005 ExportReport::play_audition ()
1007 if (_audition_num >= 0 || !_session) { return; }
1008 if (files.find (_page_num) == files.end()) { return; }
1009 audition (files[_page_num].path, files[_page_num].channels, _page_num);
1013 ExportReport::stop_audition ()
1015 if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
1016 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1017 i != timeline[_audition_num].end();
1019 (*i)->set_playhead (-1);
1023 _session->cancel_audition();
1028 ExportReport::on_switch_page (GtkNotebookPage*, guint page_num)
1030 if (_audition_num == _page_num) {
1031 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1032 i != timeline[_audition_num].end();
1034 (*i)->set_playhead (-1);
1037 _page_num = page_num;
1041 ExportReport::audition_progress (samplecnt_t pos, samplecnt_t len)
1043 if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
1044 const float p = (float)pos / len;
1045 for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
1046 i != timeline[_audition_num].end();
1048 (*i)->set_playhead (p);
1054 ExportReport::audition_seek (int page, float pos)
1056 if (_audition_num == page && _session) {
1057 _session->the_auditioner()->seek_to_percent (100.f * pos);
1062 ExportReport::on_logscale_toggled (Gtk::ToggleButton* b)
1064 bool en = b->get_active ();
1065 for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
1066 (*i)->set_logscale (en);
1071 ExportReport::on_rectivied_toggled (Gtk::ToggleButton* b)
1073 bool en = b->get_active ();
1074 for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
1075 (*i)->set_rectified (en);
1080 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)
1083 Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (get_pango_context ());
1084 const float ht = 2.f * height_2;
1086 std::vector<double> dashes;
1087 dashes.push_back (3.0);
1088 dashes.push_back (5.0);
1090 wave = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, m_l + width, ht);
1091 Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (wave);
1092 cr->set_operator (Cairo::OPERATOR_SOURCE);
1093 cr->rectangle (0, 0, m_l, ht);
1094 cr->set_source_rgba (0, 0, 0, 0);
1096 cr->rectangle (m_l, 0, width, ht);
1097 cr->set_source_rgba (0, 0, 0, 1.0);
1099 cr->set_operator (Cairo::OPERATOR_OVER);
1101 cr->set_source_rgba (.7, .7, .7, 1.0);
1102 cr->set_line_width (1.0);
1112 clip_top = ht * (1.f - alt_log_meter (-1));
1113 for (size_t x = 0 ; x < width; ++x) {
1114 const float v = alt_log_meter (fast_coefficient_to_dB (std::max (fabsf (p->peaks[c][x].max), fabsf (p->peaks[c][x].min))));
1115 cr->move_to (m_l + x - .5, ht - ht * v);
1116 cr->line_to (m_l + x - .5, ht);
1120 clip_top = ht * (1.f - dB_to_coefficient (-1));
1121 for (size_t x = 0 ; x < width; ++x) {
1122 const float v = std::max (fabsf (p->peaks[c][x].max), fabsf (p->peaks[c][x].min));
1123 cr->move_to (m_l + x - .5, ht - ht * v);
1124 cr->line_to (m_l + x - .5, ht);
1130 clip_top = height_2 - height_2 * alt_log_meter (-1);
1131 clip_bot = height_2 + height_2 * alt_log_meter (-1);
1132 for (size_t x = 0 ; x < width; ++x) {
1134 if (p->peaks[c][x].max > 0) {
1135 pmax = alt_log_meter (fast_coefficient_to_dB (p->peaks[c][x].max));
1137 pmax = -alt_log_meter (fast_coefficient_to_dB (-p->peaks[c][x].max));
1140 if (p->peaks[c][x].min > 0) {
1141 pmin = alt_log_meter (fast_coefficient_to_dB (p->peaks[c][x].min));
1143 pmin = -alt_log_meter (fast_coefficient_to_dB (-p->peaks[c][x].min));
1145 cr->move_to (m_l + x - .5, height_2 - height_2 * pmax);
1146 cr->line_to (m_l + x - .5, height_2 - height_2 * pmin);
1150 clip_top = height_2 - height_2 * dB_to_coefficient (-1);
1151 clip_bot = height_2 + height_2 * dB_to_coefficient (-1);
1152 for (size_t x = 0 ; x < width; ++x) {
1153 cr->move_to (m_l + x - .5, height_2 - height_2 * p->peaks[c][x].max);
1154 cr->line_to (m_l + x - .5, height_2 - height_2 * p->peaks[c][x].min);
1161 cr->set_source_rgba (1.0, 0, 0, 1.0);
1162 for (size_t x = 0 ; x < width; ++x) {
1163 if (p->peaks[c][x].max >= 1.0) {
1164 cr->move_to (m_l + x - .5, 0);
1165 cr->line_to (m_l + x - .5, clip_top);
1167 if (p->peaks[c][x].min <= -1.0) {
1168 cr->move_to (m_l + x - .5, clip_bot);
1169 cr->line_to (m_l + x - .5, ht);
1174 // >= -1dBTP (coeff >= .89125, libs/vamp-plugins/TruePeak.cpp)
1175 cr->set_source_rgba (1.0, 0.7, 0, 0.7);
1176 for (std::set<samplepos_t>::const_iterator i = p->truepeakpos[c].begin (); i != p->truepeakpos[c].end (); ++i) {
1177 cr->move_to (m_l + (*i) - .5, clip_top);
1178 cr->line_to (m_l + (*i) - .5, clip_bot);
1184 cr->set_source_rgba (.3, .3, .3, 0.7);
1185 cr->move_to (m_l + 0, height_2 - .5);
1186 cr->line_to (m_l + width, height_2 - .5);
1191 layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
1192 layout->set_alignment (Pango::ALIGN_LEFT);
1193 layout->set_text (_("dBFS"));
1194 layout->get_pixel_size (w, h);
1195 cr->move_to (rint (m_l - h - anw - 10), rint (height_2 + w * .5));
1196 cr->set_source_rgba (.9, .9, .9, 1.0);
1198 cr->rotate (M_PI / -2.0);
1199 layout->show_in_cairo_context (cr);
1203 cr->set_line_width (1.0);
1204 cr->set_dash (dashes, 2.0);
1205 cr->set_line_cap (Cairo::LINE_CAP_ROUND);
1207 layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
1211 XAXISLABEL ((ht - ht * alt_log_meter (-36)), _("-36"));
1212 XAXISLABEL ((ht - ht * alt_log_meter (-18)), _("-18"));
1213 XAXISLABEL ((ht - ht * alt_log_meter (-9)), _("-9"));
1214 XAXISLABEL ((ht - ht * alt_log_meter (-3)), _("-3"));
1216 XAXISLABEL ((ht - ht * .1259), _("-18"));
1217 XAXISLABEL ((ht - ht * .3548), _("-9"));
1218 XAXISLABEL ((ht - ht * .7079), _("-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"));
1225 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-18)), _("-18"));
1226 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-9)), _("-9"));
1227 XAXISLABEL ((height_2 + height_2 * alt_log_meter (-3)), _("-3"));
1229 XAXISLABEL (height_2 * 0.6452, _("-9"));
1230 XAXISLABEL (height_2 * 1.3548, _("-9"));
1231 XAXISLABEL (height_2 * 0.2921, _("-3"));
1232 XAXISLABEL (height_2 * 1.7079, _("-3"));