13
0

Vapor: Simple Export GUI

This commit is contained in:
Robin Gareus 2023-12-07 17:43:26 +01:00
parent 7228144d6e
commit 2a928dae19
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
8 changed files with 69 additions and 5 deletions

View File

@ -32,6 +32,9 @@
<menu name='Export' action='Export'>
<menuitem action='QuickExport'/>
<menuitem action='ExportAudio'/>
#ifdef VAPOR
<menuitem action='SurroundExport'/>
#endif
<menuitem action='StemExport'/>
<menuitem action='ExportVideo'/>
</menu>

View File

@ -598,6 +598,9 @@ ARDOUR_UI::install_dependent_actions ()
act = ActionManager::register_action (main_actions, X_("QuickExport"), _("Quick Audio Export..."), sigc::mem_fun (*editor, &PublicEditor::quick_export));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (main_actions, X_("SurroundExport"), _("Export Surround Master..."), sigc::mem_fun (*editor, &PublicEditor::surround_export));
act->set_sensitive (false);
act = ActionManager::register_action (main_actions, X_("ExportAudio"), _("Export to Audio File(s)..."), sigc::mem_fun (*editor, &PublicEditor::export_audio));
ActionManager::session_sensitive_actions.push_back (act);

View File

@ -333,6 +333,7 @@ public:
void export_range ();
void export_region ();
void quick_export ();
void surround_export ();
/* export for analysis only */
void loudness_assistant (bool);

View File

@ -106,6 +106,17 @@ Editor::quick_export ()
dialog.run();
}
void
Editor::surround_export ()
{
if (!_session || !_session->vapor_export_barrier ()) {
return;
}
SimpleExportDialog dialog (*this, true);
dialog.set_session (_session);
dialog.run();
}
void
Editor::loudness_assistant_marker ()
{

View File

@ -826,6 +826,9 @@ Mixer_UI::remove_surround_master (SurroundStrip* strip)
RefPtr<ToggleAction> surround_action = ActionManager::get_toggle_action (X_("Mixer"), "ToggleSurroundMaster");
surround_action->set_active (false);
Glib::RefPtr<Action> surround_export = ActionManager::get_action (X_("Main"), X_("SurroundExport"));
surround_export->set_sensitive (false);
}
void
@ -1282,9 +1285,12 @@ Mixer_UI::set_session (Session* sess)
update_scene_buttons();
RefPtr<ToggleAction> surround_action = ActionManager::get_toggle_action (X_("Mixer"), "ToggleSurroundMaster");
Glib::RefPtr<Action> surround_export = ActionManager::get_action (X_("Main"), X_("SurroundExport"));
if (!_session) {
surround_action->set_sensitive (false);
surround_export->set_sensitive (false);
PBD::Unwinder<bool> uw (ignore_plugin_reorder, true);
favorite_plugins_model->clear ();
_selection.clear ();
@ -1300,6 +1306,7 @@ Mixer_UI::set_session (Session* sess)
surround_action->set_sensitive (_session->vapor_barrier ());
surround_action->set_active (nullptr != _session->surround_master());
surround_export->set_sensitive (_session->vapor_export_barrier () && nullptr != _session->surround_master ());
#if 0
/* skip mapping all session-config vars, we only need one */
@ -4408,4 +4415,7 @@ Mixer_UI::toggle_surround_master ()
have_sm = _session->surround_master () != nullptr;
act->set_active (have_sm);
Glib::RefPtr<Action> surround_export = ActionManager::get_action (X_("Main"), X_("SurroundExport"));
surround_export->set_sensitive (have_sm && _session->vapor_export_barrier ());
}

View File

@ -310,6 +310,8 @@ public:
/** Open Simple Export Dialog */
virtual void quick_export () = 0;
virtual void surround_export () = 0;
virtual void loudness_assistant (bool) = 0;
virtual void register_actions () = 0;

View File

@ -42,11 +42,12 @@ using namespace ARDOUR;
using namespace PBD;
using namespace Gtk;
SimpleExportDialog::SimpleExportDialog (PublicEditor& editor)
SimpleExportDialog::SimpleExportDialog (PublicEditor& editor, bool vapor_export)
: ARDOUR::SimpleExport ()
, ArdourDialog (_("Quick Audio Export"), true, false)
, ArdourDialog (vapor_export ? _("Surround Master Export") : _("Quick Audio Export"), true, false)
, _editor (editor)
, _eps (true)
, _vapor_export (vapor_export)
{
if (_eps.the_combo ().get_parent ()) {
_eps.the_combo ().get_parent ()->remove (_eps.the_combo ());
@ -65,7 +66,11 @@ SimpleExportDialog::SimpleExportDialog (PublicEditor& editor)
/* clang-format off */
t->attach (LBL ("Format preset:"), 0, 1, r, r + 1, FILL, SHRINK, 0, 0);
t->attach (_eps.the_combo (), 1, 2, r, r + 1, EXPAND, SHRINK, 0, 0);
if (_vapor_export) {
t->attach (LBL ("ADM/BWF"), 1, 2, r, r + 1, EXPAND, SHRINK, 0, 0);
} else {
t->attach (_eps.the_combo (), 1, 2, r, r + 1, EXPAND | FILL, SHRINK, 0, 0);
}
++r;
t->attach (LBL ("Export range:"), 0, 1, r, r + 1, FILL, SHRINK, 0, 0);
t->attach (_range_combo, 1, 2, r, r + 1, EXPAND | FILL, SHRINK, 0, 0);
@ -149,6 +154,11 @@ SimpleExportDialog::set_session (ARDOUR::Session* s)
return;
}
if (_vapor_export && (!s->surround_master () || !s->vapor_export_barrier ())) {
set_error ("Error: Session has no exportable surround master.");
return;
}
/* check range */
Location* srl (s->locations ()->session_range_location ());
TimeSelection const& tsel (_editor.get_selection ().time);
@ -245,8 +255,31 @@ void
SimpleExportDialog::start_export ()
{
TreeModel::iterator r = _range_combo.get_active ();
std::string range_name = (*r)[_range_cols.name];
set_range ((*r)[_range_cols.start], (*r)[_range_cols.end]);
SimpleExport::set_name ((*r)[_range_cols.name]);
SimpleExport::set_name (range_name);
if (_vapor_export) {
if (range_name.empty ()) {
range_name = SimpleExport::_session->snap_name ();
}
/* Ensure timespan exists, see also SimpleExport::run_export */
auto ts = _manager->get_timespans ();
assert (ts.size () == 1);
assert (ts.front ()->timespans->size () < 2);
if (ts.front ()->timespans->size () < 1) {
ExportTimespanPtr timespan = _handler->add_timespan ();
ts.front ()->timespans->push_back (timespan);
}
/* https://professional.dolby.com/siteassets/content-creation/dolby-atmos/dolby_atmos_renderer_guide.pdf
* chapter 13.9, page 155 suggests .wav.
* There may however already be a .wav file with the given name, so -adm.wav is used.
*/
std::string vapor = Glib::build_filename (SimpleExport::_session->session_directory ().export_path (), range_name + "-adm.wav");
_manager->get_timespans ().front ()->timespans->front ()->set_vapor (vapor);
}
SimpleExport::_session->add_extra_xml (get_state ());

View File

@ -39,7 +39,7 @@ namespace ARDOUR {
class SimpleExportDialog : public ArdourDialog, virtual public ARDOUR::SimpleExport
{
public:
SimpleExportDialog (PublicEditor&);
SimpleExportDialog (PublicEditor&, bool vapor_export = false);
void set_session (ARDOUR::Session*);
@ -84,6 +84,7 @@ private:
Gtk::ComboBoxText _post_export_combo;
Gtk::Label _error_label;
Gtk::ProgressBar _progress_bar;
bool _vapor_export;
ExportRangeCols _range_cols;
Glib::RefPtr<Gtk::ListStore> _range_list;