diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index eca9813183..bb268d342a 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -32,6 +32,9 @@
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 2bb2637d15..01733f70b3 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -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);
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index c7eea59128..aa7938b334 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -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);
diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc
index 9301e7ffe6..9ff669722a 100644
--- a/gtk2_ardour/editor_export_audio.cc
+++ b/gtk2_ardour/editor_export_audio.cc
@@ -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 ()
{
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 7ddad90d69..c3b01fcbca 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -826,6 +826,9 @@ Mixer_UI::remove_surround_master (SurroundStrip* strip)
RefPtr surround_action = ActionManager::get_toggle_action (X_("Mixer"), "ToggleSurroundMaster");
surround_action->set_active (false);
+
+ Glib::RefPtr 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 surround_action = ActionManager::get_toggle_action (X_("Mixer"), "ToggleSurroundMaster");
+ Glib::RefPtr surround_export = ActionManager::get_action (X_("Main"), X_("SurroundExport"));
if (!_session) {
surround_action->set_sensitive (false);
+ surround_export->set_sensitive (false);
+
PBD::Unwinder 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 surround_export = ActionManager::get_action (X_("Main"), X_("SurroundExport"));
+ surround_export->set_sensitive (have_sm && _session->vapor_export_barrier ());
}
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 2898b375c0..507bc6e7bb 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -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;
diff --git a/gtk2_ardour/simple_export_dialog.cc b/gtk2_ardour/simple_export_dialog.cc
index 0fca00f509..ad661446cd 100644
--- a/gtk2_ardour/simple_export_dialog.cc
+++ b/gtk2_ardour/simple_export_dialog.cc
@@ -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 ());
diff --git a/gtk2_ardour/simple_export_dialog.h b/gtk2_ardour/simple_export_dialog.h
index 6daeb207b6..d0356325af 100644
--- a/gtk2_ardour/simple_export_dialog.h
+++ b/gtk2_ardour/simple_export_dialog.h
@@ -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 _range_list;