2016-02-09 21:06:47 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2016-2018 Robin Gareus <robin@gareus.org>
|
2016-02-09 21:06:47 -05:00
|
|
|
*
|
2019-08-02 17:26:43 -04:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2016-02-09 21:06:47 -05:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2019-08-02 17:26:43 -04:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2016-02-09 21:06:47 -05:00
|
|
|
*/
|
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
#include <algorithm>
|
|
|
|
|
2016-02-10 13:29:12 -05:00
|
|
|
#include <pangomm/layout.h>
|
2016-02-09 21:06:47 -05:00
|
|
|
#include <gtkmm/label.h>
|
2016-02-10 19:59:37 -05:00
|
|
|
#include <gtkmm/table.h>
|
2016-02-09 21:06:47 -05:00
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
|
2016-02-11 10:10:00 -05:00
|
|
|
#include "pbd/openuri.h"
|
2016-05-01 12:09:37 -04:00
|
|
|
#include "pbd/basename.h"
|
2017-07-17 12:34:35 -04:00
|
|
|
|
|
|
|
#include "gtkmm2ext/colors.h"
|
2016-02-09 21:06:47 -05:00
|
|
|
|
2016-02-10 19:59:37 -05:00
|
|
|
#include "ardour/audiofilesource.h"
|
2016-02-12 15:15:43 -05:00
|
|
|
#include "ardour/audioregion.h"
|
|
|
|
#include "ardour/auditioner.h"
|
|
|
|
#include "ardour/dB.h"
|
2016-09-25 16:02:16 -04:00
|
|
|
#include "ardour/logmeter.h"
|
2016-02-12 15:15:43 -05:00
|
|
|
#include "ardour/region_factory.h"
|
2016-02-10 19:59:37 -05:00
|
|
|
#include "ardour/session.h"
|
2016-02-12 15:15:43 -05:00
|
|
|
#include "ardour/smf_source.h"
|
|
|
|
#include "ardour/source_factory.h"
|
|
|
|
#include "ardour/srcfilesource.h"
|
2017-06-26 13:40:05 -04:00
|
|
|
#include "ardour/utils.h"
|
2016-02-10 19:59:37 -05:00
|
|
|
|
|
|
|
#include "audio_clock.h"
|
2021-04-06 15:06:35 -04:00
|
|
|
#include "export_analysis_graphs.h"
|
2016-02-10 13:29:12 -05:00
|
|
|
#include "export_report.h"
|
2021-04-09 22:11:59 -04:00
|
|
|
#include "loudness_settings.h"
|
2016-02-15 10:34:16 -05:00
|
|
|
#include "ui_config.h"
|
2016-02-10 09:09:01 -05:00
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2016-02-09 21:06:47 -05:00
|
|
|
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
2016-02-12 15:15:43 -05:00
|
|
|
ExportReport::ExportReport (Session* session, StatusPtr s)
|
2016-02-09 21:06:47 -05:00
|
|
|
: ArdourDialog (_("Export Report/Analysis"))
|
2016-02-12 15:15:43 -05:00
|
|
|
, _session (session)
|
2016-03-11 11:25:52 -05:00
|
|
|
, stop_btn (0)
|
|
|
|
, play_btn (0)
|
2016-02-12 16:12:40 -05:00
|
|
|
, _audition_num (-1)
|
|
|
|
, _page_num (0)
|
2016-03-11 11:25:52 -05:00
|
|
|
{
|
|
|
|
init (s->result_map, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
ExportReport::ExportReport (const std::string & title, const AnalysisResults & ar)
|
|
|
|
: ArdourDialog (title)
|
|
|
|
, _session (0)
|
|
|
|
, stop_btn (0)
|
|
|
|
, play_btn (0)
|
|
|
|
, _audition_num (-1)
|
|
|
|
, _page_num (0)
|
|
|
|
{
|
|
|
|
init (ar, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportReport::init (const AnalysisResults & ar, bool with_file)
|
2016-02-09 21:06:47 -05:00
|
|
|
{
|
2016-02-11 08:07:32 -05:00
|
|
|
set_resizable (false);
|
|
|
|
pages.set_scrollable ();
|
2016-02-09 21:06:47 -05:00
|
|
|
|
2016-02-10 15:45:34 -05:00
|
|
|
std::vector<double> dashes;
|
|
|
|
dashes.push_back (3.0);
|
|
|
|
dashes.push_back (5.0);
|
|
|
|
|
2016-02-12 16:12:40 -05:00
|
|
|
int page = 0;
|
2016-03-11 11:25:52 -05:00
|
|
|
for (AnalysisResults::const_iterator i = ar.begin (); i != ar.end (); ++i, ++page) {
|
2016-02-09 21:06:47 -05:00
|
|
|
Label *l;
|
2016-02-10 13:29:12 -05:00
|
|
|
VBox *vb = manage (new VBox ());
|
2016-02-11 08:07:32 -05:00
|
|
|
Table *t = manage (new Table (4, 4));
|
2016-02-15 10:34:16 -05:00
|
|
|
Table *wtbl = manage (new Table (3, 2));
|
|
|
|
int wrow = 0;
|
2016-02-11 10:10:00 -05:00
|
|
|
t->set_border_width (0);
|
2016-02-11 08:07:32 -05:00
|
|
|
t->set_spacings (4);
|
2016-02-15 10:34:16 -05:00
|
|
|
wtbl->set_spacings (4);
|
2016-02-11 08:07:32 -05:00
|
|
|
vb->set_spacing (4);
|
2016-02-11 10:10:00 -05:00
|
|
|
vb->set_border_width (4);
|
2016-02-11 08:07:32 -05:00
|
|
|
vb->pack_start (*t, false, false, 2);
|
2016-02-15 10:34:16 -05:00
|
|
|
vb->pack_start (*wtbl, false, false, 2);
|
2016-02-10 19:59:37 -05:00
|
|
|
|
|
|
|
std::string path = i->first;
|
2016-02-11 08:07:32 -05:00
|
|
|
ExportAnalysisPtr p = i->second;
|
2016-02-10 19:59:37 -05:00
|
|
|
|
2021-12-24 13:49:09 -05:00
|
|
|
const size_t p_width = p->width;
|
|
|
|
|
2016-02-15 10:34:16 -05:00
|
|
|
std::list<CimgPlayheadArea*> playhead_widgets;
|
2016-02-14 08:02:46 -05:00
|
|
|
|
2016-03-11 11:25:52 -05:00
|
|
|
if (with_file) {
|
|
|
|
l = manage (new Label (_("File:"), ALIGN_END));
|
|
|
|
t->attach (*l, 0, 1, 0, 1);
|
|
|
|
l = manage (new Label ());
|
|
|
|
l->set_ellipsize (Pango::ELLIPSIZE_START);
|
|
|
|
l->set_width_chars (48);
|
|
|
|
l->set_max_width_chars (48);
|
|
|
|
l->set_text (path);
|
|
|
|
l->set_alignment (ALIGN_START, ALIGN_CENTER);
|
|
|
|
t->attach (*l, 1, 3, 0, 1, FILL, SHRINK);
|
2016-02-11 10:10:00 -05:00
|
|
|
|
2016-03-11 11:25:52 -05:00
|
|
|
Button *b = manage (new Button (_("Open Folder")));
|
|
|
|
t->attach (*b, 3, 4, 0, 2, FILL, SHRINK);
|
|
|
|
b->signal_clicked ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::open_folder), path));
|
|
|
|
}
|
2016-02-12 15:15:43 -05:00
|
|
|
|
2016-02-10 19:59:37 -05:00
|
|
|
SoundFileInfo info;
|
|
|
|
std::string errmsg;
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplecnt_t file_length = 0;
|
|
|
|
samplecnt_t sample_rate = 0;
|
|
|
|
samplecnt_t start_off = 0;
|
2016-02-12 16:12:40 -05:00
|
|
|
unsigned int channels = 0;
|
2016-05-01 12:09:37 -04:00
|
|
|
std::string file_fmt;
|
2016-02-11 08:07:32 -05:00
|
|
|
|
2016-03-11 11:25:52 -05:00
|
|
|
if (with_file && AudioFileSource::get_soundfile_info (path, info, errmsg)) {
|
2016-02-10 19:59:37 -05:00
|
|
|
AudioClock * clock;
|
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
file_length = info.length;
|
|
|
|
sample_rate = info.samplerate;
|
|
|
|
start_off = info.timecode;
|
2016-02-12 15:15:43 -05:00
|
|
|
channels = info.channels;
|
2016-02-11 08:07:32 -05:00
|
|
|
|
2016-02-14 11:08:15 -05:00
|
|
|
files.insert (std::make_pair (page, AuditionInfo (path, channels)));
|
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
/* File Info Table */
|
|
|
|
|
2017-09-18 12:39:17 -04:00
|
|
|
samplecnt_t const nfr = _session ? _session->nominal_sample_rate () : 25;
|
2016-02-10 19:59:37 -05:00
|
|
|
double src_coef = (double) nfr / info.samplerate;
|
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
l = manage (new Label (_("Format:"), ALIGN_END));
|
2016-02-10 19:59:37 -05:00
|
|
|
t->attach (*l, 0, 1, 1, 2);
|
2016-05-01 12:09:37 -04:00
|
|
|
file_fmt = info.format_name;
|
|
|
|
std::replace (file_fmt.begin (), file_fmt.end (), '\n', ' ');
|
2016-02-11 08:07:32 -05:00
|
|
|
l = manage (new Label ());
|
|
|
|
l->set_ellipsize (Pango::ELLIPSIZE_START);
|
2016-02-15 10:34:16 -05:00
|
|
|
l->set_width_chars (48);
|
|
|
|
l->set_max_width_chars (48);
|
2016-05-01 12:09:37 -04:00
|
|
|
l->set_text (file_fmt);
|
2016-02-11 08:07:32 -05:00
|
|
|
l->set_alignment (ALIGN_START, ALIGN_CENTER);
|
2016-02-11 10:10:00 -05:00
|
|
|
t->attach (*l, 1, 3, 1, 2, FILL, SHRINK);
|
2016-02-10 19:59:37 -05:00
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
l = manage (new Label (_("Channels:"), ALIGN_END));
|
|
|
|
t->attach (*l, 0, 1, 2, 3);
|
2016-02-11 10:10:00 -05:00
|
|
|
l = manage (new Label (string_compose ("%1", info.channels), ALIGN_START));
|
2016-02-11 08:07:32 -05:00
|
|
|
t->attach (*l, 1, 2, 2, 3);
|
2016-02-10 19:59:37 -05:00
|
|
|
|
2022-11-10 19:53:19 -05:00
|
|
|
l = manage (new Label (_("Sample Rate:"), ALIGN_END));
|
2016-02-11 10:10:00 -05:00
|
|
|
t->attach (*l, 0, 1, 3, 4);
|
|
|
|
l = manage (new Label (string_compose (_("%1 Hz"), info.samplerate), ALIGN_START));
|
|
|
|
t->attach (*l, 1, 2, 3, 4);
|
2016-02-10 19:59:37 -05:00
|
|
|
|
|
|
|
l = manage (new Label (_("Duration:"), ALIGN_END));
|
2016-02-11 10:10:00 -05:00
|
|
|
t->attach (*l, 2, 3, 2, 3);
|
2016-02-10 19:59:37 -05:00
|
|
|
clock = manage (new AudioClock ("sfboxLengthClock", true, "", false, false, true, false));
|
|
|
|
clock->set_session (_session);
|
|
|
|
clock->set_mode (AudioClock::MinSec);
|
2020-10-19 14:37:54 -04:00
|
|
|
clock->set_duration (timecnt_t (samplecnt_t (info.length * src_coef + 0.5)), true);
|
2016-02-11 10:10:00 -05:00
|
|
|
t->attach (*clock, 3, 4, 2, 3);
|
2016-02-10 19:59:37 -05:00
|
|
|
|
|
|
|
l = manage (new Label (_("Timecode:"), ALIGN_END));
|
|
|
|
t->attach (*l, 2, 3, 3, 4);
|
|
|
|
clock = manage (new AudioClock ("sfboxTimecodeClock", true, "", false, false, false, false));
|
|
|
|
clock->set_session (_session);
|
|
|
|
clock->set_mode (AudioClock::Timecode);
|
2020-10-19 14:37:54 -04:00
|
|
|
clock->set_duration (timecnt_t (samplecnt_t (info.timecode * src_coef + 0.5)), true);
|
2016-02-10 19:59:37 -05:00
|
|
|
t->attach (*clock, 3, 4, 3, 4);
|
2016-03-11 11:25:52 -05:00
|
|
|
} else if (with_file) {
|
2018-11-19 18:38:18 -05:00
|
|
|
with_file = false;
|
|
|
|
/* Note: errmsg can have size = 1, and contain "\0\0" */
|
|
|
|
if (!errmsg.empty() && 0 != strlen(errmsg.c_str())) {
|
|
|
|
l = manage (new Label (_("Error:"), ALIGN_END));
|
|
|
|
t->attach (*l, 0, 1, 1, 2);
|
|
|
|
l = manage (new Label (errmsg, ALIGN_START));
|
|
|
|
t->attach (*l, 1, 4, 1, 2);
|
|
|
|
}
|
2016-02-10 19:59:37 -05:00
|
|
|
}
|
2016-02-09 21:06:47 -05:00
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
int w, h;
|
|
|
|
Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create (get_pango_context ());
|
2016-02-10 13:29:12 -05:00
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
// calc geometry of numerics
|
|
|
|
const float dbfs = accurate_coefficient_to_dB (p->peak);
|
|
|
|
const float dbtp = accurate_coefficient_to_dB (p->truepeak);
|
|
|
|
|
|
|
|
#define TXTSIZE(LINE, TXT, FONT) { \
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().FONT ()); \
|
|
|
|
layout->set_text (TXT); \
|
|
|
|
layout->get_pixel_size (w, h); \
|
|
|
|
if (w > mnw) { mnw = w; } \
|
|
|
|
if (h > lin[LINE]) { lin[LINE] = h; } \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TXTWIDTH(TXT, FONT) { \
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().FONT ()); \
|
|
|
|
layout->set_text (TXT); \
|
|
|
|
layout->get_pixel_size (w, h); \
|
|
|
|
if (w > mml) { mml = w; } \
|
|
|
|
}
|
|
|
|
|
2016-02-15 10:34:16 -05:00
|
|
|
int m_r = 0; // right side
|
|
|
|
int mnh = 0; // mono height
|
2016-02-11 08:07:32 -05:00
|
|
|
int mnw = 0; // max numeric width
|
2016-02-15 10:34:16 -05:00
|
|
|
int anw = 0; // spectrum annotation text width
|
|
|
|
|
2016-02-15 19:43:30 -05:00
|
|
|
int lin[6] = { 0, 0, 0, 0, 0, 0 }; // max line height
|
2016-02-11 08:07:32 -05:00
|
|
|
|
2016-02-11 16:03:14 -05:00
|
|
|
TXTSIZE(0, _("(too short integration time)"), get_SmallFont);
|
|
|
|
|
2016-02-15 12:55:24 -05:00
|
|
|
TXTSIZE(0, _("-888"), get_SmallMonospaceFont);
|
2016-02-15 10:34:16 -05:00
|
|
|
anw = w;
|
|
|
|
m_r = anw + 10;
|
|
|
|
mnh = h + 1;
|
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
TXTSIZE(0, _("Peak:"), get_SmallFont);
|
|
|
|
TXTSIZE(1, string_compose (_("%1 dBFS"), std::setprecision (1), std::fixed, dbfs), get_LargeFont);
|
|
|
|
TXTSIZE(2, _("True Peak:"), get_SmallFont);
|
|
|
|
TXTSIZE(3, string_compose (_("%1 dBTP"), std::setprecision (1), std::fixed, dbtp), get_LargeFont);
|
2016-02-15 19:43:30 -05:00
|
|
|
TXTSIZE(4, _("Normalization Gain:"), get_SmallFont);
|
|
|
|
TXTSIZE(5, _("+888.88 dB"), get_SmallMonospaceFont);
|
2016-02-11 08:07:32 -05:00
|
|
|
|
|
|
|
TXTSIZE(0, _("Integrated Loudness:"), get_SmallFont);
|
2020-07-19 23:17:34 -04:00
|
|
|
TXTSIZE(1, string_compose (_("%1 LUFS"), std::setprecision (1), std::fixed, p->integrated_loudness), get_LargeFont);
|
2016-02-11 08:07:32 -05:00
|
|
|
TXTSIZE(2, _("Loudness Range:"), get_SmallFont);
|
|
|
|
TXTSIZE(3, string_compose (_("%1 LU"), std::setprecision (1), std::fixed, p->loudness_range), get_LargeFont);
|
2020-07-19 23:17:34 -04:00
|
|
|
TXTSIZE(4, _("Max Short/Momentary:"), get_SmallFont);
|
|
|
|
TXTSIZE(5, string_compose (_("%1/%2 LUFS"), std::setprecision (1), std::fixed, p->max_loudness_short, p->max_loudness_momentary), get_SmallFont);
|
2016-02-10 09:09:01 -05:00
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
mnw += 8;
|
2016-02-15 19:43:30 -05:00
|
|
|
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];
|
|
|
|
const int hh = std::max (100, ht + 12);
|
|
|
|
const int htn = lin[0] * 1.25 + lin[1] * 1.25 + lin[2] * 1.25 + lin[3];
|
2021-12-24 13:49:09 -05:00
|
|
|
int m_l = 2 * mnw + /*hist-width*/ 540 + /*box spacing*/ 8 - /*peak-width*/ p_width - m_r; // margin left
|
2016-02-11 08:07:32 -05:00
|
|
|
|
|
|
|
int mml = 0; // min margin left -- ensure left margin is wide enough
|
|
|
|
TXTWIDTH (_("Time"), get_SmallFont);
|
|
|
|
TXTWIDTH (_("100"), get_SmallMonospaceFont);
|
2016-02-15 10:34:16 -05:00
|
|
|
m_l = (std::max(anw + mnh + 14, std::max (m_l, mml + 8)) + 3) & ~3;
|
2016-02-11 08:07:32 -05:00
|
|
|
|
2021-12-24 13:49:09 -05:00
|
|
|
mnw = (m_l - /*hist-width*/ 540 - /*box spacing*/ 8 + /*peak-width*/ p_width + m_r) / 2;
|
2016-02-11 08:07:32 -05:00
|
|
|
const int nw2 = mnw / 2; // nums, horizontal center
|
|
|
|
|
2016-03-20 07:19:31 -04:00
|
|
|
int y0[6];
|
2020-07-19 23:17:34 -04:00
|
|
|
if (true /*p->normalized*/) {
|
|
|
|
y0[0] = (hh - ht) * .5; // 5 lines
|
2016-02-15 19:43:30 -05:00
|
|
|
} else {
|
2020-07-19 23:17:34 -04:00
|
|
|
y0[0] = (hh - htn) * .5; // 4 lines
|
2016-02-15 19:43:30 -05:00
|
|
|
}
|
2016-02-11 08:07:32 -05:00
|
|
|
y0[1] = y0[0] + lin[0] * 1.25;
|
|
|
|
y0[2] = y0[1] + lin[1] * 1.25;
|
|
|
|
y0[3] = y0[2] + lin[2] * 1.25;
|
2016-02-15 19:43:30 -05:00
|
|
|
y0[4] = y0[3] + lin[3] * 1.25;
|
|
|
|
y0[5] = y0[4] + lin[4] * 1.25;
|
2016-02-11 08:07:32 -05:00
|
|
|
|
2016-05-01 12:09:37 -04:00
|
|
|
/* calc heights & alignment of png-image */
|
2021-12-24 13:49:09 -05:00
|
|
|
const float specth = p->spectrum[0].size ();
|
2016-05-01 12:09:37 -04:00
|
|
|
const float waveh2 = std::min (100, 8 * lin[0] / (int) p->n_channels);
|
2021-04-06 18:13:06 -04:00
|
|
|
const float loudnh = 180;
|
2016-05-01 12:09:37 -04:00
|
|
|
|
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> png_surface;
|
|
|
|
int png_w = 0;
|
|
|
|
int png_y0 = 0;
|
|
|
|
|
2021-05-11 17:09:23 -04:00
|
|
|
Glib::RefPtr<Gdk::Window> win = get_window ();
|
|
|
|
Glib::RefPtr<Gdk::Screen> screen;
|
|
|
|
if (win) {
|
|
|
|
screen = win->get_screen();
|
|
|
|
} else {
|
|
|
|
screen = Gdk::Screen::get_default();
|
|
|
|
}
|
|
|
|
int win_h = screen ? screen->get_height() : -1;
|
|
|
|
int tbl_h = 4 * (lin[4] * 1.3 + 4); // height of file-info table t
|
|
|
|
win_h -= 60 + lin[4] * 4.5 ; // window title, file-tab, bottom buttons
|
|
|
|
|
2016-05-01 12:09:37 -04:00
|
|
|
if (with_file && UIConfiguration::instance().get_save_export_analysis_image ()) { /*png image */
|
|
|
|
const int top_w = 540 + 2 * (mnw + 4); // 4px spacing
|
2021-12-24 13:49:09 -05:00
|
|
|
const int wav_w = m_l + m_r + 4 + p->width;
|
|
|
|
const int spc_w = m_l + m_r + 4 + p->width / specth;
|
2016-05-01 12:09:37 -04:00
|
|
|
int ann_h = 0;
|
|
|
|
int linesp = 0;
|
|
|
|
|
|
|
|
if (channels > 0 && file_length > 0 && sample_rate > 0) {
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
|
2021-04-04 20:05:47 -04:00
|
|
|
layout->set_text (X_("00:00:00.0"));
|
2016-05-01 12:09:37 -04:00
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
int height = h * 1.75;
|
|
|
|
ann_h = 4 + height /* Time Axis */;
|
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
2021-04-04 20:05:47 -04:00
|
|
|
layout->set_text (X_("0|A8"));
|
2016-05-01 12:09:37 -04:00
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
linesp = h * 1.5;
|
|
|
|
ann_h += 4 + 3 * linesp; /* File Info */;
|
|
|
|
}
|
|
|
|
|
2021-04-09 22:11:59 -04:00
|
|
|
int png_h = hh + 4 + p->n_channels * (2 * waveh2 + 4) + ann_h + specth + 4;
|
|
|
|
|
|
|
|
if (p->have_loudness && p->have_dbtp && p->have_lufs_graph && sample_rate > 0) {
|
|
|
|
png_h += loudnh + 4;
|
|
|
|
}
|
|
|
|
if (p->have_loudness && p->have_dbtp && p->integrated_loudness > -180) {
|
|
|
|
png_h += lin[0] * 4 + 4;
|
|
|
|
}
|
|
|
|
|
2016-05-01 12:09:37 -04:00
|
|
|
png_w = std::max (std::max (top_w, wav_w), spc_w);
|
|
|
|
|
|
|
|
png_surface = Cairo::ImageSurface::create (Cairo::FORMAT_RGB24, png_w, png_h);
|
|
|
|
Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
|
|
|
|
pcx->set_source_rgb (.2, .2, .2);
|
|
|
|
pcx->paint ();
|
|
|
|
|
|
|
|
if (channels > 0 && file_length > 0 && sample_rate > 0) {
|
|
|
|
png_y0 += 4;
|
|
|
|
// Add file-name, format, duration, sample-rate & timecode
|
|
|
|
pcx->set_source_rgb (.7, .7, .7);
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
layout->set_alignment (Pango::ALIGN_LEFT);
|
|
|
|
|
|
|
|
#define IMGLABEL(X0, STR, VAL) { \
|
|
|
|
layout->set_text (STR); \
|
|
|
|
pcx->move_to (X0, png_y0); \
|
|
|
|
layout->get_pixel_size (w, h); \
|
|
|
|
layout->show_in_cairo_context (pcx); \
|
|
|
|
layout->set_text (VAL); \
|
|
|
|
pcx->move_to (X0 + w + 2, png_y0); \
|
|
|
|
layout->show_in_cairo_context (pcx); \
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO get max width of labels per column, right-align labels, x-align 1/3, 2/3 columns
|
|
|
|
const int lx0 = m_l;
|
2017-06-26 13:40:05 -04:00
|
|
|
const int lx1 = m_l + png_w * 2 / 3; // right-col is short (channels, SR, duration)
|
|
|
|
std::string sha1sum = ARDOUR::compute_sha1_of_file (path);
|
|
|
|
if (!sha1sum.empty()) {
|
|
|
|
sha1sum = " (sha1: " + sha1sum + ")";
|
|
|
|
}
|
2016-05-01 12:09:37 -04:00
|
|
|
|
2017-06-26 13:40:05 -04:00
|
|
|
IMGLABEL (lx0, _("File:"), Glib::path_get_basename (path) + sha1sum);
|
2016-05-01 12:09:37 -04:00
|
|
|
IMGLABEL (lx1, _("Channels:"), string_compose ("%1", channels));
|
|
|
|
png_y0 += linesp;
|
|
|
|
|
|
|
|
IMGLABEL (lx0, _("Format:"), file_fmt);
|
2022-11-10 19:53:19 -05:00
|
|
|
IMGLABEL (lx1, _("Sample Rate:"), string_compose (_("%1 Hz"), sample_rate));
|
2016-05-01 12:09:37 -04:00
|
|
|
png_y0 += linesp;
|
|
|
|
|
|
|
|
if (_session) {
|
|
|
|
Timecode::Time tct;
|
|
|
|
_session->sample_to_timecode (start_off, tct, false, false);
|
|
|
|
IMGLABEL (lx0, _("Timecode:"), Timecode::timecode_format_time (tct));
|
|
|
|
}
|
|
|
|
IMGLABEL (lx1, _("Duration:"), Timecode::timecode_format_sampletime (file_length, sample_rate, 1000, false));
|
|
|
|
png_y0 += linesp;
|
|
|
|
}
|
|
|
|
}
|
2016-02-11 08:07:32 -05:00
|
|
|
|
|
|
|
{ /* peak, loudness and R128 histogram */
|
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> nums = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, mnw, hh);
|
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> ebur = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, mnw, hh);
|
|
|
|
|
|
|
|
/* peak and true-peak numerics */
|
2016-02-10 09:09:01 -05:00
|
|
|
Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (nums);
|
|
|
|
cr->set_source_rgba (0, 0, 0, 1.0);
|
2016-02-11 08:07:32 -05:00
|
|
|
cr->paint ();
|
2016-02-10 09:09:01 -05:00
|
|
|
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
layout->set_alignment (Pango::ALIGN_LEFT);
|
2016-02-11 08:07:32 -05:00
|
|
|
layout->set_text (_("Peak:"));
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
2016-02-11 08:07:32 -05:00
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[0]);
|
|
|
|
cr->set_source_rgba (.7, .7, .7, 1.0);
|
|
|
|
layout->show_in_cairo_context (cr);
|
2016-02-10 13:29:12 -05:00
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
|
2016-02-12 06:52:49 -05:00
|
|
|
layout->set_text (string_compose (_("%1 dBFS"), std::setprecision (1), std::fixed, dbfs));
|
2016-02-11 08:07:32 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[1]);
|
2016-02-12 06:52:49 -05:00
|
|
|
if (dbfs >= 0.f) { cr->set_source_rgba (1.0, .1, .1, 1.0); }
|
|
|
|
else if (dbfs > -1.f) { cr->set_source_rgba (1.0, .7, .0, 1.0); }
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
2016-02-11 08:07:32 -05:00
|
|
|
|
|
|
|
if (p->have_dbtp) {
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
layout->set_text (_("True Peak:"));
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[2]);
|
|
|
|
cr->set_source_rgba (.7, .7, .7, 1.0);
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
|
2016-02-12 06:52:49 -05:00
|
|
|
layout->set_text (string_compose (_("%1 dBTP"), std::setprecision (1), std::fixed, dbtp));
|
2016-02-11 08:07:32 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[3]);
|
2016-02-12 06:52:49 -05:00
|
|
|
if (dbtp >= 0.f) { cr->set_source_rgba (1.0, .1, .1, 1.0); }
|
|
|
|
else if (dbtp > -1.f) { cr->set_source_rgba (1.0, .7, .0, 1.0); }
|
2016-02-11 08:07:32 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
}
|
|
|
|
|
2016-02-15 19:43:30 -05:00
|
|
|
if (p->normalized) {
|
|
|
|
const float ndb = accurate_coefficient_to_dB (p->norm_gain_factor);
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
layout->set_text (_("Normalization Gain:"));
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[4]);
|
|
|
|
cr->set_source_rgba (.7, .7, .7, 1.0);
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallMonospaceFont ());
|
|
|
|
layout->set_text (string_compose (_("%1 dB"), std::setprecision (2), std::showpos, std::fixed, ndb));
|
|
|
|
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[5]);
|
|
|
|
// TODO tweak thresholds
|
|
|
|
if (p->norm_gain_factor < 1.0) {
|
|
|
|
cr->set_source_rgba (1.0, .7, .1, 1.0);
|
|
|
|
} else if (p->norm_gain_factor == 1.0) {
|
|
|
|
cr->set_source_rgba (.7, .7, .7, 1.0);
|
|
|
|
} else if (fabsf (ndb) < 12) {
|
|
|
|
cr->set_source_rgba (.1, 1.0, .1, 1.0);
|
|
|
|
} else if (fabsf (ndb) < 18) {
|
|
|
|
cr->set_source_rgba (1.0, .7, .1, 1.0);
|
|
|
|
} else {
|
|
|
|
cr->set_source_rgba (1.0, .1, .1, 1.0);
|
|
|
|
}
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
}
|
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
nums->flush ();
|
|
|
|
|
|
|
|
/* EBU R128 numerics */
|
|
|
|
cr = Cairo::Context::create (ebur);
|
|
|
|
cr->set_source_rgba (0, 0, 0, 1.0);
|
|
|
|
cr->paint ();
|
2016-02-10 13:29:12 -05:00
|
|
|
|
2016-02-10 09:09:01 -05:00
|
|
|
cr->set_source_rgba (.7, .7, .7, 1.0);
|
|
|
|
|
2016-02-10 19:59:37 -05:00
|
|
|
if (!i->second->have_loudness) {
|
|
|
|
layout->set_alignment (Pango::ALIGN_CENTER);
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
|
2016-02-11 16:03:14 -05:00
|
|
|
layout->set_text (_("Not\nAvailable"));
|
2016-02-10 19:59:37 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
2016-02-11 16:03:14 -05:00
|
|
|
cr->move_to (rint (nw2 - w * .5), rint ((hh - h) * .5));
|
2016-02-10 19:59:37 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
}
|
2020-07-19 23:17:34 -04:00
|
|
|
else if (p->integrated_loudness == -200 && p->loudness_range == 0) {
|
2021-04-09 11:34:38 -04:00
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
layout->set_alignment (Pango::ALIGN_LEFT);
|
|
|
|
layout->set_text (_("Integrated Loudness:"));
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
2021-04-09 11:34:38 -04:00
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[0]);
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_text (_("Not available"));
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[1]);
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_text (_("(too short integration time)"));
|
|
|
|
layout->get_pixel_size (w, h);
|
2021-04-09 11:34:38 -04:00
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[2]);
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
2021-04-09 11:34:38 -04:00
|
|
|
if (p->max_loudness_short > -200 && p->max_loudness_momentary > -200) {
|
|
|
|
layout->set_text (_("Max Short/Momentary:"));
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[4]);
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_text (string_compose (_("%1/%2 LUFS"), std::setprecision (1), std::fixed, p->max_loudness_short, p->max_loudness_momentary));
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[5]);
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
}
|
2016-02-10 13:29:12 -05:00
|
|
|
} else {
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
2016-02-10 19:59:37 -05:00
|
|
|
layout->set_alignment (Pango::ALIGN_LEFT);
|
2016-02-11 08:07:32 -05:00
|
|
|
layout->set_text (_("Integrated Loudness:"));
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
2016-02-11 08:07:32 -05:00
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[0]);
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
|
2020-07-19 23:17:34 -04:00
|
|
|
layout->set_text (string_compose (_("%1 LUFS"), std::setprecision (1), std::fixed, p->integrated_loudness));
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
2016-02-11 08:07:32 -05:00
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[1]);
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
2016-02-11 08:07:32 -05:00
|
|
|
layout->set_text (_("Loudness Range:"));
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
2016-02-11 08:07:32 -05:00
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[2]);
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_LargeFont ());
|
2016-02-11 08:07:32 -05:00
|
|
|
layout->set_text (string_compose (_("%1 LU"), std::setprecision (1), std::fixed, p->loudness_range));
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
2016-02-11 08:07:32 -05:00
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[3]);
|
2016-02-10 13:29:12 -05:00
|
|
|
layout->show_in_cairo_context (cr);
|
2020-07-19 23:17:34 -04:00
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
layout->set_text (_("Max Short/Momentary:"));
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[4]);
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
|
|
|
layout->set_text (string_compose (_("%1/%2 LUFS"), std::setprecision (1), std::fixed, p->max_loudness_short, p->max_loudness_momentary));
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (nw2 - w * .5), y0[5]);
|
|
|
|
layout->show_in_cairo_context (cr);
|
2016-02-10 13:29:12 -05:00
|
|
|
}
|
2016-02-11 08:07:32 -05:00
|
|
|
ebur->flush ();
|
2016-02-10 09:09:01 -05:00
|
|
|
|
|
|
|
/* draw loudness histogram */
|
2021-04-06 15:06:35 -04:00
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> hist = ArdourGraphs::loudness_histogram (get_pango_context(), p, hh, 540);
|
2016-02-11 08:07:32 -05:00
|
|
|
|
2016-05-01 12:09:37 -04:00
|
|
|
if (png_surface) {
|
|
|
|
Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
|
|
|
|
pcx->set_source (nums, 0, png_y0);
|
|
|
|
pcx->paint ();
|
|
|
|
pcx->set_source (hist, (png_w - 540) / 2, png_y0);
|
|
|
|
pcx->paint ();
|
|
|
|
pcx->set_source (ebur, png_w - mnw, png_y0);
|
|
|
|
pcx->paint ();
|
|
|
|
png_y0 += hh + 4;
|
|
|
|
}
|
|
|
|
|
2016-02-10 09:09:01 -05:00
|
|
|
CimgArea *nu = manage (new CimgArea (nums));
|
2016-02-11 08:07:32 -05:00
|
|
|
CimgArea *eb = manage (new CimgArea (ebur));
|
2016-02-10 09:09:01 -05:00
|
|
|
CimgArea *hi = manage (new CimgArea (hist));
|
2016-02-10 13:29:12 -05:00
|
|
|
HBox *hb = manage (new HBox ());
|
2016-02-10 09:09:01 -05:00
|
|
|
hb->set_spacing (4);
|
2016-02-11 08:07:32 -05:00
|
|
|
hb->pack_start (*nu, false, false);
|
|
|
|
hb->pack_start (*hi, false, false);
|
|
|
|
hb->pack_start (*eb, false, false);
|
2016-02-15 10:34:16 -05:00
|
|
|
|
|
|
|
wtbl->attach (*hb, 0, 2, wrow, wrow + 1, SHRINK, SHRINK);
|
|
|
|
++wrow;
|
2021-05-11 17:09:23 -04:00
|
|
|
tbl_h += hh + 4;
|
2016-02-09 21:06:47 -05:00
|
|
|
}
|
|
|
|
|
2016-02-15 11:37:51 -05:00
|
|
|
{
|
|
|
|
VBox *lrb = manage (new VBox());
|
|
|
|
ToggleButton *log = manage (new ToggleButton (S_("Logscale|Lg")));
|
|
|
|
ToggleButton *rec = manage (new ToggleButton (S_("Rectified|Rf")));
|
2016-05-21 21:31:27 -04:00
|
|
|
Gtkmm2ext::UI::instance()->set_tip (log, _("Logscale"));
|
|
|
|
Gtkmm2ext::UI::instance()->set_tip (rec, _("Rectified"));
|
|
|
|
|
2016-02-15 11:37:51 -05:00
|
|
|
lrb->pack_start (*log, false, false, 5);
|
|
|
|
lrb->pack_end (*rec, false, false, 5);
|
|
|
|
log->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_logscale_toggled), log));
|
|
|
|
rec->signal_toggled ().connect (sigc::bind (sigc::mem_fun (*this, &ExportReport::on_rectivied_toggled), rec));
|
|
|
|
lrb->show_all ();
|
|
|
|
wtbl->attach (*lrb, 1, 2, wrow, wrow + p->n_channels, SHRINK, SHRINK);
|
|
|
|
}
|
|
|
|
|
2016-02-10 19:59:37 -05:00
|
|
|
for (uint32_t c = 0; c < p->n_channels; ++c) {
|
2016-02-10 13:29:12 -05:00
|
|
|
/* draw waveform */
|
2021-12-24 13:49:09 -05:00
|
|
|
const size_t width = p->width;
|
2016-02-12 06:52:49 -05:00
|
|
|
|
2021-04-06 15:06:35 -04:00
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> wave = ArdourGraphs::draw_waveform (get_pango_context (), p, c, waveh2, m_l, false, false);
|
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> wave_log = ArdourGraphs::draw_waveform (get_pango_context (), p, c, waveh2, m_l, true, false);
|
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> wave_rect = ArdourGraphs::draw_waveform (get_pango_context (), p, c, waveh2, m_l, false, true);
|
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> wave_lr = ArdourGraphs::draw_waveform (get_pango_context (), p, c, waveh2, m_l, true, true);
|
2016-02-12 06:52:49 -05:00
|
|
|
|
2016-02-15 10:34:16 -05:00
|
|
|
CimgWaveArea *wv = manage (new CimgWaveArea (wave, wave_log, wave_rect, wave_lr, m_l, width));
|
2016-02-12 06:52:49 -05:00
|
|
|
|
2016-02-14 08:02:46 -05:00
|
|
|
playhead_widgets.push_back (wv);
|
2016-02-15 11:37:51 -05:00
|
|
|
waves.push_back (wv);
|
2016-02-14 08:02:46 -05:00
|
|
|
wv->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
|
2016-02-15 10:34:16 -05:00
|
|
|
wtbl->attach (*wv, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
|
|
|
|
++wrow;
|
2021-05-11 17:09:23 -04:00
|
|
|
tbl_h += 2 * waveh2 + 4;
|
2016-05-01 12:09:37 -04:00
|
|
|
|
|
|
|
if (png_surface) {
|
|
|
|
Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
|
|
|
|
pcx->set_source (wave, 0, png_y0);
|
|
|
|
pcx->paint ();
|
|
|
|
png_y0 += 2 * waveh2 + 4;
|
|
|
|
}
|
2016-02-09 21:06:47 -05:00
|
|
|
}
|
|
|
|
|
2016-02-12 16:12:40 -05:00
|
|
|
if (channels > 0 && file_length > 0 && sample_rate > 0)
|
2016-02-11 08:07:32 -05:00
|
|
|
{
|
|
|
|
/* Time Axis -- re-use waveform width */
|
2021-12-24 13:49:09 -05:00
|
|
|
const size_t width = p->width;
|
2021-04-06 15:06:35 -04:00
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> ytme = ArdourGraphs::time_axis (get_pango_context (), width, m_l, start_off, file_length, sample_rate);
|
2016-02-11 08:07:32 -05:00
|
|
|
|
2016-02-15 10:34:16 -05:00
|
|
|
CimgPlayheadArea *tm = manage (new CimgPlayheadArea (ytme, m_l, width, true));
|
2016-02-14 08:02:46 -05:00
|
|
|
playhead_widgets.push_back (tm);
|
2016-02-13 07:51:10 -05:00
|
|
|
tm->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
|
2016-02-15 10:34:16 -05:00
|
|
|
wtbl->attach (*tm, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
|
|
|
|
++wrow;
|
2021-05-11 17:09:23 -04:00
|
|
|
tbl_h += ytme->get_height() + 4;
|
2016-05-01 12:09:37 -04:00
|
|
|
|
|
|
|
if (png_surface) {
|
|
|
|
Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
|
|
|
|
pcx->set_source (ytme, 0, png_y0);
|
|
|
|
pcx->paint ();
|
2021-04-06 15:06:35 -04:00
|
|
|
png_y0 += ytme->get_height() + 4;
|
2016-05-01 12:09:37 -04:00
|
|
|
}
|
2016-02-11 08:07:32 -05:00
|
|
|
}
|
|
|
|
|
2016-02-09 21:06:47 -05:00
|
|
|
{
|
2016-02-11 08:07:32 -05:00
|
|
|
/* Draw Spectrum */
|
2021-04-06 15:06:35 -04:00
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> spec = ArdourGraphs::draw_spectrum (get_pango_context (), p, specth, m_l);
|
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> scale = ArdourGraphs::spectrum_legend (get_pango_context (), specth, m_r);
|
2016-02-15 10:34:16 -05:00
|
|
|
|
2021-04-06 15:06:35 -04:00
|
|
|
CimgPlayheadArea *sp = manage (new CimgPlayheadArea (spec, m_l, spec->get_width () - m_l));
|
2016-02-14 08:02:46 -05:00
|
|
|
playhead_widgets.push_back (sp);
|
|
|
|
sp->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
|
2016-02-15 10:34:16 -05:00
|
|
|
CimgArea *an = manage (new CimgArea (scale));
|
|
|
|
wtbl->attach (*sp, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
|
|
|
|
wtbl->attach (*an, 1, 2, wrow, wrow + 1, SHRINK, SHRINK);
|
|
|
|
++wrow;
|
2021-05-11 17:09:23 -04:00
|
|
|
tbl_h += spec->get_height() + 4;
|
2016-05-01 12:09:37 -04:00
|
|
|
|
|
|
|
if (png_surface) {
|
|
|
|
Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
|
|
|
|
pcx->set_source (spec, 0, png_y0);
|
|
|
|
pcx->paint ();
|
|
|
|
pcx->set_source (scale, png_w - m_r, png_y0);
|
|
|
|
pcx->paint ();
|
2021-04-06 18:13:06 -04:00
|
|
|
png_y0 += spec->get_height() + 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->have_loudness && p->have_dbtp && p->have_lufs_graph && sample_rate > 0) {
|
|
|
|
/* Loudness */
|
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> las = ArdourGraphs::plot_loudness (get_pango_context (), p, loudnh, m_l, sample_rate);
|
2021-05-11 17:09:23 -04:00
|
|
|
|
|
|
|
if (win_h < 0 || win_h > tbl_h + las->get_height()) {
|
|
|
|
CimgPlayheadArea *lp = manage (new CimgPlayheadArea (las, m_l, las->get_width () - m_l));
|
|
|
|
playhead_widgets.push_back (lp);
|
|
|
|
lp->seek_playhead.connect (sigc::bind<0> (sigc::mem_fun (*this, &ExportReport::audition_seek), page));
|
|
|
|
wtbl->attach (*lp, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
|
|
|
|
++wrow;
|
|
|
|
tbl_h += las->get_height() + 4;
|
|
|
|
}
|
2021-04-06 18:13:06 -04:00
|
|
|
|
|
|
|
if (png_surface) {
|
|
|
|
Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
|
|
|
|
pcx->set_source (las, 0, png_y0);
|
|
|
|
pcx->paint ();
|
|
|
|
png_y0 += las->get_height() + 4;
|
2016-05-01 12:09:37 -04:00
|
|
|
}
|
2016-02-09 21:06:47 -05:00
|
|
|
}
|
|
|
|
|
2021-04-09 22:11:59 -04:00
|
|
|
if (p->have_loudness && p->have_dbtp && p->integrated_loudness > -180) {
|
|
|
|
|
2021-12-23 10:48:58 -05:00
|
|
|
ALoudnessPresets alp (false);
|
|
|
|
std::vector<ALoudnessPreset> const& lp = alp.presets ();
|
|
|
|
std::vector<ALoudnessPreset>::const_iterator pi;
|
|
|
|
|
|
|
|
/* calc max label width */
|
|
|
|
int max_wl = 10;
|
|
|
|
int n_reports = 0;
|
|
|
|
for (pi = lp.begin (); pi != lp.end (); ++pi) {
|
|
|
|
if (!pi->report) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
++n_reports;
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
layout->set_text (pi->label);
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
max_wl = std::max (max_wl, w);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* calc max status width */
|
|
|
|
int max_wx = 10;
|
2022-11-07 05:56:21 -05:00
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_ArdourLargeFont ());
|
2021-12-23 10:48:58 -05:00
|
|
|
|
2023-01-16 15:41:22 -05:00
|
|
|
layout->set_text (u8"\u274C"); // cross mark
|
2021-12-23 10:48:58 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
max_wx = std::max (max_wx, w);
|
2023-01-16 15:41:22 -05:00
|
|
|
layout->set_text (u8"\U0001F509"); // speaker icon w/1 bar
|
2021-12-23 10:48:58 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
max_wx = std::max (max_wx, w);
|
2023-01-16 15:41:22 -05:00
|
|
|
layout->set_text (u8"\u2714"); // heavy check mark
|
2021-12-23 10:48:58 -05:00
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
max_wx = std::max (max_wx, w);
|
|
|
|
|
|
|
|
/* calc geometry of conformity analysis, add 1/2 max_wx space */
|
2021-12-24 13:49:09 -05:00
|
|
|
int max_w = std::min<int> (p_width, max_wl + max_wx * 1.5);
|
2021-12-23 10:48:58 -05:00
|
|
|
|
2021-12-24 13:49:09 -05:00
|
|
|
int per_line = std::min<int> (5, p_width / max_w);
|
2021-12-23 10:48:58 -05:00
|
|
|
assert (per_line > 0);
|
|
|
|
int lines = ceilf ((float)n_reports / per_line);
|
2021-04-09 22:11:59 -04:00
|
|
|
|
2021-12-23 11:16:56 -05:00
|
|
|
/* calc column width */
|
|
|
|
std::vector<int> col_w (per_line);
|
|
|
|
int i;
|
|
|
|
for (i = 0, pi = lp.begin (); pi != lp.end (); ++pi) {
|
|
|
|
if (!pi->report) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
int col = i % per_line;
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
layout->set_text (pi->label);
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
col_w[col] = std::max (col_w[col], w);
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
2021-12-24 13:49:09 -05:00
|
|
|
int cw = p_width + m_l;
|
2021-12-23 10:48:58 -05:00
|
|
|
int ch = (lines * 1.3 + .65) * lin[0];
|
|
|
|
|
2021-04-09 22:11:59 -04:00
|
|
|
Cairo::RefPtr<Cairo::ImageSurface> conf = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, cw, ch);
|
|
|
|
Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create (conf);
|
|
|
|
cr->set_source_rgba (0, 0, 0, 1.0);
|
|
|
|
cr->paint ();
|
|
|
|
|
|
|
|
cr->set_operator (Cairo::OPERATOR_SOURCE);
|
|
|
|
cr->rectangle (0, 0, m_l - 1, ch);
|
|
|
|
cr->set_source_rgba (0, 0, 0, 0);
|
|
|
|
cr->fill ();
|
|
|
|
cr->set_operator (Cairo::OPERATOR_OVER);
|
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallerFont ());
|
|
|
|
layout->set_alignment (Pango::ALIGN_RIGHT);
|
|
|
|
cr->set_source_rgba (.9, .9, .9, 1.0);
|
|
|
|
layout->set_text (_("Conformity\nAnalysis"));
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
cr->move_to (rint (m_l - w - 6), rint ((ch - h) * .5));
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
layout->set_alignment (Pango::ALIGN_LEFT);
|
|
|
|
|
2021-12-23 10:48:58 -05:00
|
|
|
const float lufs = rint (p->integrated_loudness * 10.f) / 10.f;
|
|
|
|
const float dbfs = rint (accurate_coefficient_to_dB (p->peak) * 10.f) / 10.f;
|
|
|
|
const float dbtp = rint (accurate_coefficient_to_dB (p->truepeak) * 10.f) / 10.f;
|
2021-04-09 22:11:59 -04:00
|
|
|
|
2021-12-23 10:48:58 -05:00
|
|
|
int yl = lin[0] / 2;
|
2021-04-09 22:11:59 -04:00
|
|
|
|
2021-12-23 11:16:56 -05:00
|
|
|
for (i = 0, pi = lp.begin (); pi != lp.end (); ++pi) {
|
2021-04-09 22:11:59 -04:00
|
|
|
if (!pi->report) {
|
|
|
|
continue;
|
|
|
|
}
|
2021-12-23 11:16:56 -05:00
|
|
|
int col = i % per_line;
|
|
|
|
int xl = m_l + 10 + col * (cw - 20 - m_l) / per_line;
|
2021-04-09 22:11:59 -04:00
|
|
|
|
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_SmallFont ());
|
|
|
|
cr->set_source_rgba (.9, .9, .9, 1.0);
|
|
|
|
layout->set_text (pi->label);
|
|
|
|
cr->move_to (xl, yl);
|
|
|
|
layout->get_pixel_size (w, h);
|
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
cr->move_to (xl + w + 5, yl);
|
|
|
|
|
2022-11-07 05:56:21 -05:00
|
|
|
layout->set_font_description (UIConfiguration::instance ().get_ArdourLargeFont ());
|
2021-04-09 22:11:59 -04:00
|
|
|
cr->set_source_rgba (.9, .9, .9, 1.0);
|
|
|
|
if (lufs > pi->LUFS_range[0]
|
|
|
|
|| (pi->enable[0] && dbfs > pi->level[0])
|
|
|
|
|| (pi->enable[1] && dbtp > pi->level[1])
|
|
|
|
) {
|
|
|
|
cr->set_source_rgba (1, 0, .0, 1.0);
|
2023-01-16 15:41:22 -05:00
|
|
|
layout->set_text (u8"\u274C"); // cross mark
|
2021-04-09 22:11:59 -04:00
|
|
|
} else if (lufs < pi->LUFS_range[1]) {
|
|
|
|
cr->set_source_rgba (.6, .7, 0, 1.0);
|
2023-01-16 15:41:22 -05:00
|
|
|
layout->set_text (u8"\U0001F509"); // speaker icon w/1 bar
|
2021-04-09 22:11:59 -04:00
|
|
|
} else {
|
|
|
|
cr->set_source_rgba (.1, 1, .1, 1.0);
|
2023-01-16 15:41:22 -05:00
|
|
|
layout->set_text (u8"\u2714"); // heavy check mark
|
2021-04-09 22:11:59 -04:00
|
|
|
}
|
|
|
|
int ww, hh;
|
|
|
|
layout->get_pixel_size (ww, hh);
|
2021-12-23 11:16:56 -05:00
|
|
|
cr->move_to (xl + col_w[col] + 4, yl - (hh - h) * .5);
|
2021-04-09 22:11:59 -04:00
|
|
|
layout->show_in_cairo_context (cr);
|
|
|
|
|
2021-12-23 10:48:58 -05:00
|
|
|
if (i % per_line == per_line - 1) {
|
2021-04-09 22:11:59 -04:00
|
|
|
yl += lin[0] * 1.3;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
2021-05-11 17:09:23 -04:00
|
|
|
|
|
|
|
if (win_h < 0 || win_h > tbl_h + conf->get_height()) {
|
|
|
|
CimgArea *ci = manage (new CimgArea (conf));
|
|
|
|
wtbl->attach (*ci, 0, 1, wrow, wrow + 1, SHRINK, SHRINK);
|
|
|
|
++wrow;
|
|
|
|
tbl_h += conf->get_height() + 4;
|
|
|
|
}
|
2021-04-09 22:11:59 -04:00
|
|
|
|
|
|
|
if (png_surface) {
|
|
|
|
Cairo::RefPtr<Cairo::Context> pcx = Cairo::Context::create (png_surface);
|
|
|
|
pcx->set_source (conf, 0, png_y0);
|
|
|
|
pcx->paint ();
|
|
|
|
png_y0 += conf->get_height() + 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-14 08:02:46 -05:00
|
|
|
timeline[page] = playhead_widgets;
|
2016-02-14 11:08:15 -05:00
|
|
|
|
|
|
|
HBox *tab = manage (new HBox ());
|
|
|
|
l = manage (new Label (Glib::path_get_basename (path)));
|
|
|
|
Gtk::Image *img = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_MENU));
|
|
|
|
tab->pack_start (*img);
|
|
|
|
tab->pack_start (*l);
|
|
|
|
l->show();
|
|
|
|
tab->show();
|
|
|
|
img->hide();
|
|
|
|
pages.pages ().push_back (Notebook_Helpers::TabElem (*vb, *tab));
|
2016-02-12 16:12:40 -05:00
|
|
|
pages.signal_switch_page().connect (sigc::mem_fun (*this, &ExportReport::on_switch_page));
|
2016-05-01 12:09:37 -04:00
|
|
|
|
|
|
|
if (png_surface) {
|
|
|
|
assert (with_file && !path.empty ());
|
|
|
|
std::string imgpath = Glib::build_filename (Glib::path_get_dirname (path), PBD::basename_nosuffix (path) + ".png");
|
|
|
|
PBD::info << string_compose(_("Writing Export Analysis Image: %1."), imgpath) << endmsg;
|
|
|
|
png_surface->write_to_png (imgpath);
|
|
|
|
}
|
2016-02-09 21:06:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pages.set_show_tabs (true);
|
|
|
|
pages.show_all ();
|
|
|
|
pages.set_name ("ExportReportNotebook");
|
|
|
|
pages.set_current_page (0);
|
|
|
|
|
2016-02-11 08:07:32 -05:00
|
|
|
get_vbox ()->set_spacing (4);
|
|
|
|
get_vbox ()->pack_start (pages, false, false);
|
2016-02-09 21:06:47 -05:00
|
|
|
|
2016-02-12 15:15:43 -05:00
|
|
|
if (_session) {
|
|
|
|
_session->AuditionActive.connect(auditioner_connections, invalidator (*this), boost::bind (&ExportReport::audition_active, this, _1), gui_context());
|
2016-02-12 16:12:40 -05:00
|
|
|
_session->the_auditioner()->AuditionProgress.connect(auditioner_connections, invalidator (*this), boost::bind (&ExportReport::audition_progress, this, _1, _2), gui_context());
|
2016-02-12 15:15:43 -05:00
|
|
|
}
|
|
|
|
|
2016-03-11 11:25:52 -05:00
|
|
|
if (_session && with_file) {
|
|
|
|
play_btn = add_button (Stock::MEDIA_PLAY, RESPONSE_ACCEPT);
|
|
|
|
stop_btn = add_button (Stock::MEDIA_STOP, RESPONSE_ACCEPT);
|
|
|
|
}
|
2016-02-12 15:15:43 -05:00
|
|
|
add_button (Stock::CLOSE, RESPONSE_CLOSE);
|
|
|
|
|
|
|
|
set_default_response (RESPONSE_CLOSE);
|
2016-03-11 11:25:52 -05:00
|
|
|
if (_session && with_file) {
|
|
|
|
stop_btn->signal_clicked().connect (sigc::mem_fun (*this, &ExportReport::stop_audition));
|
|
|
|
play_btn->signal_clicked().connect (sigc::mem_fun (*this, &ExportReport::play_audition));
|
|
|
|
stop_btn->set_sensitive (false);
|
|
|
|
}
|
2016-02-09 21:06:47 -05:00
|
|
|
show_all ();
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ExportReport::run ()
|
|
|
|
{
|
2016-02-12 16:12:40 -05:00
|
|
|
do {
|
|
|
|
int i = ArdourDialog::run ();
|
|
|
|
if (i == Gtk::RESPONSE_DELETE_EVENT || i == RESPONSE_CLOSE) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (1);
|
|
|
|
|
2016-02-12 15:15:43 -05:00
|
|
|
if (_session) {
|
|
|
|
_session->cancel_audition();
|
|
|
|
}
|
|
|
|
return RESPONSE_CLOSE;
|
2016-02-09 21:06:47 -05:00
|
|
|
}
|
2016-02-11 10:10:00 -05:00
|
|
|
|
|
|
|
void
|
2016-02-12 15:15:43 -05:00
|
|
|
ExportReport::open_folder (std::string p)
|
2016-02-11 10:10:00 -05:00
|
|
|
{
|
2016-02-17 10:29:58 -05:00
|
|
|
PBD::open_folder (Glib::path_get_dirname(p));
|
2016-02-11 10:10:00 -05:00
|
|
|
}
|
2016-02-12 15:15:43 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
ExportReport::audition_active (bool active)
|
|
|
|
{
|
2016-03-11 11:25:52 -05:00
|
|
|
if (!stop_btn || !play_btn) {
|
|
|
|
return;
|
|
|
|
}
|
2016-02-12 15:15:43 -05:00
|
|
|
stop_btn->set_sensitive (active);
|
2016-02-14 11:08:15 -05:00
|
|
|
play_btn->set_sensitive (!active);
|
|
|
|
|
|
|
|
if (!active && _audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
|
2016-02-15 10:34:16 -05:00
|
|
|
for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
|
2016-02-14 08:02:46 -05:00
|
|
|
i != timeline[_audition_num].end();
|
|
|
|
++i) {
|
|
|
|
(*i)->set_playhead (-1);
|
|
|
|
}
|
2016-02-13 19:24:00 -05:00
|
|
|
}
|
2016-02-14 11:08:15 -05:00
|
|
|
|
|
|
|
if (_audition_num >= 0 ) {
|
|
|
|
Widget *page = pages.get_nth_page (_audition_num);
|
|
|
|
HBox *box = static_cast<Gtk::HBox*> (pages.get_tab_label (*page));
|
|
|
|
if (!active) {
|
|
|
|
(*(box->get_children().begin()))->hide ();
|
|
|
|
} else {
|
|
|
|
(*(box->get_children().begin()))->show ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!active) {
|
|
|
|
_audition_num = -1;
|
|
|
|
}
|
2016-02-12 15:15:43 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-02-12 16:12:40 -05:00
|
|
|
ExportReport::audition (std::string path, unsigned n_chn, int page)
|
2016-02-12 15:15:43 -05:00
|
|
|
{
|
|
|
|
assert (_session);
|
|
|
|
_session->cancel_audition();
|
|
|
|
|
2016-02-14 11:08:15 -05:00
|
|
|
if (n_chn ==0) { return; }
|
|
|
|
|
2016-02-12 15:15:43 -05:00
|
|
|
/* can't really happen, unless the user replaces the file while the dialog is open.. */
|
|
|
|
if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
|
|
|
|
PBD::warning << string_compose(_("Could not read file: %1 (%2)."), path, strerror(errno)) << endmsg;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (SMFSource::valid_midi_file (path)) { return; }
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<Region> r;
|
2016-02-12 15:15:43 -05:00
|
|
|
SourceList srclist;
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<AudioFileSource> afs;
|
2016-02-12 15:15:43 -05:00
|
|
|
bool old_sbp = AudioSource::get_build_peakfiles ();
|
|
|
|
|
|
|
|
/* don't even think of building peakfiles for these files */
|
|
|
|
AudioSource::set_build_peakfiles (false);
|
|
|
|
|
2016-02-12 16:12:40 -05:00
|
|
|
for (unsigned int n = 0; n < n_chn; ++n) {
|
2016-02-12 15:15:43 -05:00
|
|
|
try {
|
2023-02-16 18:33:28 -05:00
|
|
|
afs = std::dynamic_pointer_cast<AudioFileSource> (
|
2016-02-12 15:15:43 -05:00
|
|
|
SourceFactory::createExternal (DataType::AUDIO, *_session,
|
|
|
|
path, n,
|
|
|
|
Source::Flag (ARDOUR::AudioFileSource::NoPeakFile), false));
|
2017-09-18 12:39:17 -04:00
|
|
|
if (afs->sample_rate() != _session->nominal_sample_rate()) {
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<SrcFileSource> sfs (new SrcFileSource(*_session, afs, ARDOUR::SrcGood));
|
2016-02-12 15:15:43 -05:00
|
|
|
srclist.push_back(sfs);
|
|
|
|
} else {
|
|
|
|
srclist.push_back(afs);
|
|
|
|
}
|
|
|
|
} catch (failed_constructor& err) {
|
|
|
|
PBD::error << _("Could not access soundfile: ") << path << endmsg;
|
|
|
|
AudioSource::set_build_peakfiles (old_sbp);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AudioSource::set_build_peakfiles (old_sbp);
|
|
|
|
|
|
|
|
if (srclist.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
afs = std::dynamic_pointer_cast<AudioFileSource> (srclist[0]);
|
2016-02-12 15:15:43 -05:00
|
|
|
std::string rname = region_name_from_path (afs->path(), false);
|
|
|
|
|
|
|
|
PBD::PropertyList plist;
|
|
|
|
|
2020-12-18 15:01:53 -05:00
|
|
|
plist.add (ARDOUR::Properties::start, timepos_t (0));
|
2020-10-19 14:37:54 -04:00
|
|
|
plist.add (ARDOUR::Properties::length, srclist[0]->length ());
|
2016-02-12 15:15:43 -05:00
|
|
|
plist.add (ARDOUR::Properties::name, rname);
|
|
|
|
plist.add (ARDOUR::Properties::layer, 0);
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
r = std::dynamic_pointer_cast<AudioRegion> (RegionFactory::create (srclist, plist, false));
|
2016-02-12 15:15:43 -05:00
|
|
|
|
2020-10-19 14:37:54 -04:00
|
|
|
r->set_position (timepos_t ());
|
2016-02-12 15:15:43 -05:00
|
|
|
_session->audition_region(r);
|
2016-02-12 16:12:40 -05:00
|
|
|
_audition_num = page;
|
2016-02-12 15:15:43 -05:00
|
|
|
}
|
|
|
|
|
2016-02-14 11:08:15 -05:00
|
|
|
void
|
|
|
|
ExportReport::play_audition ()
|
|
|
|
{
|
|
|
|
if (_audition_num >= 0 || !_session) { return; }
|
|
|
|
if (files.find (_page_num) == files.end()) { return; }
|
|
|
|
audition (files[_page_num].path, files[_page_num].channels, _page_num);
|
|
|
|
}
|
|
|
|
|
2016-02-12 15:15:43 -05:00
|
|
|
void
|
|
|
|
ExportReport::stop_audition ()
|
|
|
|
{
|
2016-02-14 11:08:15 -05:00
|
|
|
if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
|
2016-02-15 10:34:16 -05:00
|
|
|
for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
|
2016-02-14 08:02:46 -05:00
|
|
|
i != timeline[_audition_num].end();
|
|
|
|
++i) {
|
|
|
|
(*i)->set_playhead (-1);
|
|
|
|
}
|
2016-02-12 16:12:40 -05:00
|
|
|
}
|
2016-02-12 15:15:43 -05:00
|
|
|
if (_session) {
|
|
|
|
_session->cancel_audition();
|
|
|
|
}
|
2016-02-12 16:12:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportReport::on_switch_page (GtkNotebookPage*, guint page_num)
|
|
|
|
{
|
|
|
|
if (_audition_num == _page_num) {
|
2016-02-15 10:34:16 -05:00
|
|
|
for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
|
2016-02-14 08:02:46 -05:00
|
|
|
i != timeline[_audition_num].end();
|
|
|
|
++i) {
|
|
|
|
(*i)->set_playhead (-1);
|
|
|
|
}
|
2016-02-12 16:12:40 -05:00
|
|
|
}
|
|
|
|
_page_num = page_num;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-09-18 12:39:17 -04:00
|
|
|
ExportReport::audition_progress (samplecnt_t pos, samplecnt_t len)
|
2016-02-12 16:12:40 -05:00
|
|
|
{
|
2016-02-14 11:08:15 -05:00
|
|
|
if (_audition_num == _page_num && timeline.find (_audition_num) != timeline.end ()) {
|
2016-02-14 08:02:46 -05:00
|
|
|
const float p = (float)pos / len;
|
2016-02-15 10:34:16 -05:00
|
|
|
for (std::list<CimgPlayheadArea*>::const_iterator i = timeline[_audition_num].begin();
|
2016-02-14 08:02:46 -05:00
|
|
|
i != timeline[_audition_num].end();
|
|
|
|
++i) {
|
|
|
|
(*i)->set_playhead (p);
|
|
|
|
}
|
2016-02-12 16:12:40 -05:00
|
|
|
}
|
2016-02-12 15:15:43 -05:00
|
|
|
}
|
2016-02-13 07:51:10 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
ExportReport::audition_seek (int page, float pos)
|
|
|
|
{
|
|
|
|
if (_audition_num == page && _session) {
|
|
|
|
_session->the_auditioner()->seek_to_percent (100.f * pos);
|
|
|
|
}
|
|
|
|
}
|
2016-02-15 10:34:16 -05:00
|
|
|
|
2016-02-15 11:37:51 -05:00
|
|
|
void
|
|
|
|
ExportReport::on_logscale_toggled (Gtk::ToggleButton* b)
|
|
|
|
{
|
|
|
|
bool en = b->get_active ();
|
|
|
|
for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
|
|
|
|
(*i)->set_logscale (en);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ExportReport::on_rectivied_toggled (Gtk::ToggleButton* b)
|
|
|
|
{
|
|
|
|
bool en = b->get_active ();
|
|
|
|
for (std::list<CimgWaveArea*>::iterator i = waves.begin (); i != waves.end (); ++i) {
|
|
|
|
(*i)->set_rectified (en);
|
|
|
|
}
|
|
|
|
}
|