Add a no-file, analysis only export mode

This commit is contained in:
Robin Gareus 2022-05-28 18:18:24 +02:00
parent c1f92861c6
commit b04ee501ff
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 78 additions and 35 deletions

View file

@ -37,6 +37,7 @@
#include "ardour/audioregion.h" #include "ardour/audioregion.h"
#include "ardour/export_channel_configuration.h" #include "ardour/export_channel_configuration.h"
#include "ardour/export_format_specification.h" #include "ardour/export_format_specification.h"
#include "ardour/export_format_manager.h"
#include "ardour/export_status.h" #include "ardour/export_status.h"
#include "ardour/export_handler.h" #include "ardour/export_handler.h"
#include "ardour/profile.h" #include "ardour/profile.h"
@ -63,6 +64,7 @@ ExportDialog::ExportDialog (PublicEditor & editor, std::string title, ARDOUR::Ex
, list_files_button (_("List files")) , list_files_button (_("List files"))
, previous_progress (0) , previous_progress (0)
, _initialized (false) , _initialized (false)
, _analysis_only (false)
{ } { }
ExportDialog::~ExportDialog () ExportDialog::~ExportDialog ()
@ -156,13 +158,16 @@ ExportDialog::init ()
progress_widget.pack_start (progress_bar, false, false, 6); progress_widget.pack_start (progress_bar, false, false, 6);
/* Buttons */ /* Buttons */
cancel_button = add_button (Gtk::Stock::CANCEL, RESPONSE_CANCEL); cancel_button = add_button (Gtk::Stock::CANCEL, RESPONSE_CANCEL);
export_button = add_button (_("Export"), RESPONSE_FAST); export_button = add_button (_("Export"), RESPONSE_FAST);
analyze_button = add_button (_("Only Analyze"), RESPONSE_ANALYZE);
get_action_area ()->set_child_secondary (*analyze_button);
set_default_response (RESPONSE_FAST); set_default_response (RESPONSE_FAST);
cancel_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::close_dialog)); cancel_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::close_dialog));
export_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::do_export)); export_button->signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &ExportDialog::do_export), false));
analyze_button->signal_clicked().connect (sigc::bind (sigc::mem_fun (*this, &ExportDialog::do_export), true));
file_notebook->soundcloud_export_selector = soundcloud_selector; file_notebook->soundcloud_export_selector = soundcloud_selector;
@ -261,6 +266,7 @@ ExportDialog::update_warnings_and_example_filename ()
list_files_string = ""; list_files_string = "";
export_button->set_sensitive (true); export_button->set_sensitive (true);
analyze_button->set_sensitive (true);
/* Add new warnings */ /* Add new warnings */
@ -346,8 +352,18 @@ ExportDialog::soundcloud_upload_progress(double total, double now, std::string t
} }
void void
ExportDialog::do_export () ExportDialog::do_export (bool analysis_only)
{ {
_analysis_only = analysis_only;
if (analysis_only) {
for (auto const& fmt : profile_manager->get_formats ()) {
boost::shared_ptr<ExportFormatSpecification> fmp = fmt->format;
fmp->set_format_id (ExportFormatBase::F_None);
fmp->set_type (ExportFormatBase::T_None);
fmp->set_analyse (true);
}
}
try { try {
profile_manager->prepare_for_export (); profile_manager->prepare_for_export ();
handler->soundcloud_username = soundcloud_selector->username (); handler->soundcloud_username = soundcloud_selector->username ();
@ -388,6 +404,7 @@ ExportDialog::show_progress ()
cancel_button->set_label (_("Stop Export")); cancel_button->set_label (_("Stop Export"));
export_button->set_sensitive (false); export_button->set_sensitive (false);
analyze_button->set_sensitive (false);
progress_bar.set_fraction (0.0); progress_bar.set_fraction (0.0);
warning_widget.hide_all(); warning_widget.hide_all();
@ -454,8 +471,13 @@ ExportDialog::show_progress ()
if (!status->aborted() && status->result_map.size() > 0) { if (!status->aborted() && status->result_map.size() > 0) {
hide(); hide();
ExportReport er (_session, status); if (_analysis_only) {
er.run(); ExportReport er (_("Export Report/Analysis"), status->result_map);
er.run();
} else {
ExportReport er (_session, status);
er.run();
}
} }
if (!status->aborted()) { if (!status->aborted()) {
@ -478,33 +500,50 @@ ExportDialog::progress_timeout ()
{ {
std::string status_text; std::string status_text;
float progress = -1; float progress = -1;
switch (status->active_job) {
case ExportStatus::Exporting: if (_analysis_only) {
status_text = string_compose (_("Exporting '%3' (timespan %1 of %2)"), switch (status->active_job) {
status->timespan, status->total_timespans, status->timespan_name); case ExportStatus::Exporting:
progress = ((float) status->processed_samples_current_timespan) / status->total_samples_current_timespan; status_text = string_compose (_("Export for Analysis '%3' (timespan %1 of %2)"),
break; status->timespan, status->total_timespans, status->timespan_name);
case ExportStatus::Normalizing: progress = ((float) status->processed_samples_current_timespan) / status->total_samples_current_timespan;
status_text = string_compose (_("Normalizing '%3' (timespan %1 of %2)"), break;
status->timespan, status->total_timespans, status->timespan_name); default:
progress = ((float) status->current_postprocessing_cycle) / status->total_postprocessing_cycles; status_text = string_compose (_("Analyzing '%3' (timespan %1 of %2)"),
break; status->timespan, status->total_timespans, status->timespan_name);
case ExportStatus::Encoding: progress = ((float) status->current_postprocessing_cycle) / status->total_postprocessing_cycles;
status_text = string_compose (_("Encoding '%3' (timespan %1 of %2)"), break;
status->timespan, status->total_timespans, status->timespan_name); }
progress = ((float) status->current_postprocessing_cycle) / status->total_postprocessing_cycles; } else {
break;
case ExportStatus::Tagging: switch (status->active_job) {
status_text = string_compose (_("Tagging '%3' (timespan %1 of %2)"), case ExportStatus::Exporting:
status->timespan, status->total_timespans, status->timespan_name); status_text = string_compose (_("Exporting '%3' (timespan %1 of %2)"),
break; status->timespan, status->total_timespans, status->timespan_name);
case ExportStatus::Uploading: progress = ((float) status->processed_samples_current_timespan) / status->total_samples_current_timespan;
status_text = string_compose (_("Uploading '%3' (timespan %1 of %2)"), break;
status->timespan, status->total_timespans, status->timespan_name); case ExportStatus::Normalizing:
break; status_text = string_compose (_("Normalizing '%3' (timespan %1 of %2)"),
case ExportStatus::Command: status->timespan, status->total_timespans, status->timespan_name);
status_text = string_compose (_("Running Post Export Command for '%1'"), status->timespan_name); progress = ((float) status->current_postprocessing_cycle) / status->total_postprocessing_cycles;
break; break;
case ExportStatus::Encoding:
status_text = string_compose (_("Encoding '%3' (timespan %1 of %2)"),
status->timespan, status->total_timespans, status->timespan_name);
progress = ((float) status->current_postprocessing_cycle) / status->total_postprocessing_cycles;
break;
case ExportStatus::Tagging:
status_text = string_compose (_("Tagging '%3' (timespan %1 of %2)"),
status->timespan, status->total_timespans, status->timespan_name);
break;
case ExportStatus::Uploading:
status_text = string_compose (_("Uploading '%3' (timespan %1 of %2)"),
status->timespan, status->total_timespans, status->timespan_name);
break;
case ExportStatus::Command:
status_text = string_compose (_("Running Post Export Command for '%1'"), status->timespan_name);
break;
}
} }
progress_bar.set_text (status_text); progress_bar.set_text (status_text);
@ -529,6 +568,7 @@ void
ExportDialog::add_error (string const & text) ExportDialog::add_error (string const & text)
{ {
export_button->set_sensitive (false); export_button->set_sensitive (false);
analyze_button->set_sensitive (false);
if (warn_string.empty()) { if (warn_string.empty()) {
warn_string = _("<span color=\"#ffa755\">Error: ") + text + "</span>"; warn_string = _("<span color=\"#ffa755\">Error: ") + text + "</span>";

View file

@ -66,6 +66,7 @@ public:
enum Responses { enum Responses {
RESPONSE_RT, RESPONSE_RT,
RESPONSE_FAST, RESPONSE_FAST,
RESPONSE_ANALYZE,
RESPONSE_CANCEL RESPONSE_CANCEL
}; };
@ -112,7 +113,7 @@ private:
void update_warnings_and_example_filename (); void update_warnings_and_example_filename ();
void show_conflicting_files (); void show_conflicting_files ();
void do_export (); void do_export (bool analysis_only);
void maybe_set_session_dirty (); void maybe_set_session_dirty ();
@ -152,13 +153,15 @@ private:
float previous_progress; // Needed for gtk bug workaround float previous_progress; // Needed for gtk bug workaround
bool _initialized; bool _initialized;
bool _analysis_only;
void soundcloud_upload_progress(double total, double now, std::string title); void soundcloud_upload_progress(double total, double now, std::string title);
/* Buttons */ /* Buttons */
Gtk::Button * cancel_button; Gtk::Button* cancel_button;
Gtk::Button * export_button; Gtk::Button* export_button;
Gtk::Button* analyze_button;
}; };