summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-07-16 02:15:56 +0200
committerRobin Gareus <robin@gareus.org>2016-07-16 02:15:56 +0200
commit15433457f2d81b50a576ffa3aca2bf311edd2370 (patch)
tree14b586c54fedcc5bc12c3270f334ae7350d11863
parentbd50bfa96776c4a1f8370fe8016aea4f896e7b9a (diff)
export RT support as Timespan option
-rw-r--r--gtk2_ardour/export_channel_selector.h2
-rw-r--r--gtk2_ardour/export_dialog.cc52
-rw-r--r--gtk2_ardour/export_dialog.h3
-rw-r--r--gtk2_ardour/export_timespan_selector.cc135
-rw-r--r--gtk2_ardour/export_timespan_selector.h21
5 files changed, 183 insertions, 30 deletions
diff --git a/gtk2_ardour/export_channel_selector.h b/gtk2_ardour/export_channel_selector.h
index 6dd770cbb3..d5607ef30b 100644
--- a/gtk2_ardour/export_channel_selector.h
+++ b/gtk2_ardour/export_channel_selector.h
@@ -236,6 +236,8 @@ class TrackExportChannelSelector : public ExportChannelSelector
virtual void sync_with_manager ();
+ bool track_output () const { return track_output_button.get_active(); }
+
private:
void fill_list();
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc
index 59985a0459..2922edf117 100644
--- a/gtk2_ardour/export_dialog.cc
+++ b/gtk2_ardour/export_dialog.cc
@@ -24,6 +24,7 @@
#include <gtkmm/messagedialog.h>
#include "ardour/audioregion.h"
+#include "ardour/export_channel_configuration.h"
#include "ardour/export_status.h"
#include "ardour/export_handler.h"
#include "ardour/profile.h"
@@ -96,9 +97,13 @@ ExportDialog::set_session (ARDOUR::Session* s)
preset_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::sync_with_manager));
timespan_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename));
channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename));
+ channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_realtime_selection));
file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename));
update_warnings_and_example_filename ();
+ update_realtime_selection ();
+
+ _session->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&ExportDialog::parameter_changed, this, _1), gui_context());
}
void
@@ -205,6 +210,7 @@ ExportDialog::sync_with_manager ()
file_notebook->sync_with_manager ();
update_warnings_and_example_filename ();
+ update_realtime_selection ();
}
void
@@ -246,6 +252,47 @@ ExportDialog::update_warnings_and_example_filename ()
}
void
+ExportDialog::update_realtime_selection ()
+{
+ bool rt_ok = true;
+ switch (profile_manager->type ()) {
+ case ExportProfileManager::RegularExport:
+ break;
+ case ExportProfileManager::RangeExport:
+ break;
+ case ExportProfileManager::SelectionExport:
+ break;
+ case ExportProfileManager::RegionExport:
+ if (!profile_manager->get_channel_configs().empty ()) {
+ switch (profile_manager->get_channel_configs().front()->config->region_processing_type ()) {
+ case RegionExportChannelFactory::Raw:
+ case RegionExportChannelFactory::Fades:
+ rt_ok = false;
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ case ExportProfileManager::StemExport:
+ if (! static_cast<TrackExportChannelSelector*>(channel_selector.get())->track_output ()) {
+ rt_ok = false;
+ }
+ break;
+ }
+
+ timespan_selector->allow_realtime_export (rt_ok);
+}
+
+void
+ExportDialog::parameter_changed (std::string const& p)
+{
+ if (p == "realtime-export") {
+ update_realtime_selection ();
+ }
+}
+
+void
ExportDialog::show_conflicting_files ()
{
ArdourDialog dialog (_("Files that will be overwritten"), true);
@@ -361,6 +408,11 @@ ExportDialog::progress_timeout ()
status->timespan, status->total_timespans, status->timespan_name);
progress = ((float) status->current_normalize_cycle) / status->total_normalize_cycles;
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_normalize_cycle) / status->total_normalize_cycles;
+ break;
case ExportStatus::Tagging:
status_text = string_compose (_("Tagging '%3' (timespan %1 of %2)"),
status->timespan, status->total_timespans, status->timespan_name);
diff --git a/gtk2_ardour/export_dialog.h b/gtk2_ardour/export_dialog.h
index 54446b7d1b..fee7013577 100644
--- a/gtk2_ardour/export_dialog.h
+++ b/gtk2_ardour/export_dialog.h
@@ -103,6 +103,9 @@ class ExportDialog : public ArdourDialog, public PBD::ScopedConnectionList
void do_export ();
+ void update_realtime_selection ();
+ void parameter_changed (std::string const&);
+
void show_progress ();
gint progress_timeout ();
diff --git a/gtk2_ardour/export_timespan_selector.cc b/gtk2_ardour/export_timespan_selector.cc
index ad9470af32..c87d4ef9e4 100644
--- a/gtk2_ardour/export_timespan_selector.cc
+++ b/gtk2_ardour/export_timespan_selector.cc
@@ -39,30 +39,40 @@ using namespace ARDOUR;
using namespace PBD;
using std::string;
-ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager) :
- manager (manager),
- time_format_label (_("Show Times as:"), Gtk::ALIGN_LEFT)
+ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager, bool multi)
+ : manager (manager)
+ , _realtime_available (true)
+ , time_format_label (_("Show Times as:"), Gtk::ALIGN_LEFT)
+ , realtime_checkbutton (_("Realtime Export"))
{
set_session (session);
option_hbox.pack_start (time_format_label, false, false, 0);
option_hbox.pack_start (time_format_combo, false, false, 6);
- Gtk::Button* b = Gtk::manage (new Gtk::Button (_("Select All")));
- b->signal_clicked().connect (
- sigc::bind (
- sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), true
- )
- );
- option_hbox.pack_start (*b, false, false, 6);
-
- b = Gtk::manage (new Gtk::Button (_("Deselect All")));
- b->signal_clicked().connect (
- sigc::bind (
- sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), false
- )
- );
- option_hbox.pack_start (*b, false, false, 6);
+ if (multi) {
+ Gtk::Button* b = Gtk::manage (new Gtk::Button (_("Select All")));
+ b->signal_clicked().connect (
+ sigc::bind (
+ sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), true
+ )
+ );
+ option_hbox.pack_start (*b, false, false, 6);
+
+ b = Gtk::manage (new Gtk::Button (_("Deselect All")));
+ b->signal_clicked().connect (
+ sigc::bind (
+ sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), false
+ )
+ );
+ option_hbox.pack_start (*b, false, false, 6);
+ }
+ option_hbox.pack_start (realtime_checkbutton, false, false, 6);
+ realtime_checkbutton.set_active (session->config.get_realtime_export ());
+
+ realtime_checkbutton.signal_toggled ().connect (
+ sigc::mem_fun (*this, &ExportTimespanSelector::toggle_realtime)
+ );
range_scroller.add (range_view);
@@ -131,7 +141,7 @@ ExportTimespanSelector::location_sorter(Gtk::TreeModel::iterator a, Gtk::TreeMod
}
void
-ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc)
+ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc, bool rt)
{
ExportTimespanPtr span = _session->get_export_handler()->add_timespan();
@@ -145,6 +155,7 @@ ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc)
span->set_range (loc->start(), loc->end());
span->set_name (loc->name());
span->set_range_id (id);
+ span->set_realtime (rt);
state->timespans->push_back (span);
}
@@ -168,6 +179,30 @@ ExportTimespanSelector::sync_with_manager ()
}
void
+ExportTimespanSelector::allow_realtime_export (bool yn)
+{
+ if (_realtime_available == yn) {
+ return;
+ }
+ _realtime_available = yn;
+ realtime_checkbutton.set_sensitive (_realtime_available);
+ update_timespans ();
+}
+
+void
+ExportTimespanSelector::toggle_realtime ()
+{
+ const bool realtime = !_session->config.get_realtime_export ();
+ _session->config.set_realtime_export (realtime);
+ realtime_checkbutton.set_inconsistent (false);
+ realtime_checkbutton.set_active (realtime);
+
+ for (Gtk::TreeStore::Children::iterator it = range_list->children().begin(); it != range_list->children().end(); ++it) {
+ it->set_value (range_cols.realtime, realtime);
+ }
+}
+
+void
ExportTimespanSelector::change_time_format ()
{
state->time_format = time_format_combo.get_active()->get_value (time_format_cols.format);
@@ -357,13 +392,18 @@ ExportTimespanSelector::set_selection_state_of_all_timespans (bool s)
/*** ExportTimespanSelectorSingle ***/
ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, std::string range_id) :
- ExportTimespanSelector (session, manager),
+ ExportTimespanSelector (session, manager, false),
range_id (range_id)
{
range_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER);
+ range_view.append_column_editable (_("RT"), range_cols.realtime);
range_view.append_column_editable (_("Range"), range_cols.name);
- if (Gtk::CellRendererText * renderer = dynamic_cast<Gtk::CellRendererText *> (range_view.get_column_cell_renderer (0))) {
+ if (Gtk::CellRendererToggle * renderer = dynamic_cast<Gtk::CellRendererToggle *> (range_view.get_column_cell_renderer (0))) {
+ renderer->signal_toggled().connect (sigc::hide (sigc::mem_fun (*this, &ExportTimespanSelectorSingle::update_timespans)));
+ }
+
+ if (Gtk::CellRendererText * renderer = dynamic_cast<Gtk::CellRendererText *> (range_view.get_column_cell_renderer (1))) {
renderer->signal_edited().connect (sigc::mem_fun (*this, &ExportTimespanSelectorSingle::update_range_name));
}
@@ -376,9 +416,17 @@ ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * se
}
void
+ExportTimespanSelectorSingle::allow_realtime_export (bool yn)
+{
+ ExportTimespanSelector::allow_realtime_export (yn);
+ range_view.get_column (0)->set_visible (_realtime_available);
+}
+
+void
ExportTimespanSelectorSingle::fill_range_list ()
{
if (!state) { return; }
+ const bool realtime = _session->config.get_realtime_export ();
std::string id;
if (!range_id.compare (X_("selection"))) {
@@ -400,11 +448,12 @@ ExportTimespanSelectorSingle::fill_range_list ()
row[range_cols.location] = *it;
row[range_cols.selected] = true;
+ row[range_cols.realtime] = realtime;
row[range_cols.name] = (*it)->name();
row[range_cols.label] = construct_label (*it);
row[range_cols.length] = construct_length (*it);
- add_range_to_selection (*it);
+ add_range_to_selection (*it, false);
break;
}
@@ -413,19 +462,39 @@ ExportTimespanSelectorSingle::fill_range_list ()
set_time_format_from_state();
}
+void
+ExportTimespanSelectorSingle::update_timespans ()
+{
+ state->timespans->clear();
+ const bool realtime = _session->config.get_realtime_export ();
+ bool inconsistent = false;
+
+ for (Gtk::TreeStore::Children::iterator it = range_list->children().begin(); it != range_list->children().end(); ++it) {
+ add_range_to_selection (it->get_value (range_cols.location), it->get_value (range_cols.realtime) && _realtime_available);
+ if (it->get_value (range_cols.realtime) != realtime) {
+ inconsistent = true;
+ }
+ }
+ realtime_checkbutton.set_inconsistent (inconsistent);
+}
+
/*** ExportTimespanSelectorMultiple ***/
ExportTimespanSelectorMultiple::ExportTimespanSelectorMultiple (ARDOUR::Session * session, ProfileManagerPtr manager) :
- ExportTimespanSelector (session, manager)
+ ExportTimespanSelector (session, manager, true)
{
range_scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
range_view.append_column_editable ("", range_cols.selected);
+ range_view.append_column_editable (_("RT"), range_cols.realtime);
range_view.append_column_editable (_("Range"), range_cols.name);
if (Gtk::CellRendererToggle * renderer = dynamic_cast<Gtk::CellRendererToggle *> (range_view.get_column_cell_renderer (0))) {
renderer->signal_toggled().connect (sigc::hide (sigc::mem_fun (*this, &ExportTimespanSelectorMultiple::update_selection)));
}
- if (Gtk::CellRendererText * renderer = dynamic_cast<Gtk::CellRendererText *> (range_view.get_column_cell_renderer (1))) {
+ if (Gtk::CellRendererToggle * renderer = dynamic_cast<Gtk::CellRendererToggle *> (range_view.get_column_cell_renderer (1))) {
+ renderer->signal_toggled().connect (sigc::hide (sigc::mem_fun (*this, &ExportTimespanSelectorMultiple::update_selection)));
+ }
+ if (Gtk::CellRendererText * renderer = dynamic_cast<Gtk::CellRendererText *> (range_view.get_column_cell_renderer (2))) {
renderer->signal_edited().connect (sigc::mem_fun (*this, &ExportTimespanSelectorMultiple::update_range_name));
}
@@ -438,9 +507,17 @@ ExportTimespanSelectorMultiple::ExportTimespanSelectorMultiple (ARDOUR::Session
}
void
+ExportTimespanSelectorMultiple::allow_realtime_export (bool yn)
+{
+ ExportTimespanSelector::allow_realtime_export (yn);
+ range_view.get_column (1)->set_visible (_realtime_available);
+}
+
+void
ExportTimespanSelectorMultiple::fill_range_list ()
{
if (!state) { return; }
+ const bool realtime = _session->config.get_realtime_export ();
range_list->clear();
@@ -453,6 +530,7 @@ ExportTimespanSelectorMultiple::fill_range_list ()
row[range_cols.location] = *it;
row[range_cols.selected] = false;
+ row[range_cols.realtime] = realtime;
row[range_cols.name] = (*it)->name();
row[range_cols.label] = construct_label (*it);
row[range_cols.length] = construct_length (*it);
@@ -474,6 +552,7 @@ ExportTimespanSelectorMultiple::set_selection_from_state ()
if ((id == "selection" && loc == state->selection_range.get()) ||
(id == loc->id().to_s())) {
tree_it->set_value (range_cols.selected, true);
+ tree_it->set_value (range_cols.realtime, (*it)->realtime ());
}
}
}
@@ -492,11 +571,17 @@ void
ExportTimespanSelectorMultiple::update_timespans ()
{
state->timespans->clear();
+ const bool realtime = _session->config.get_realtime_export ();
+ bool inconsistent = false;
for (Gtk::TreeStore::Children::iterator it = range_list->children().begin(); it != range_list->children().end(); ++it) {
if (it->get_value (range_cols.selected)) {
- add_range_to_selection (it->get_value (range_cols.location));
+ add_range_to_selection (it->get_value (range_cols.location), it->get_value (range_cols.realtime) && _realtime_available);
+ }
+ if (it->get_value (range_cols.realtime) != realtime) {
+ inconsistent = true;
}
}
+ realtime_checkbutton.set_inconsistent (inconsistent);
}
diff --git a/gtk2_ardour/export_timespan_selector.h b/gtk2_ardour/export_timespan_selector.h
index 1216670991..91a53e5fb2 100644
--- a/gtk2_ardour/export_timespan_selector.h
+++ b/gtk2_ardour/export_timespan_selector.h
@@ -60,11 +60,12 @@ class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
public:
- ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager);
+ ExportTimespanSelector (ARDOUR::Session * session, ProfileManagerPtr manager, bool multi);
virtual ~ExportTimespanSelector ();
void sync_with_manager ();
+ virtual void allow_realtime_export (bool);
sigc::signal<void> CriticalSelectionChanged;
@@ -72,11 +73,14 @@ class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
ProfileManagerPtr manager;
TimespanStatePtr state;
+ bool _realtime_available;
virtual void fill_range_list () = 0;
+ virtual void update_timespans () = 0;
- void add_range_to_selection (ARDOUR::Location const * loc);
+ void add_range_to_selection (ARDOUR::Location const * loc, bool rt);
void set_time_format_from_state ();
+ void toggle_realtime ();
void change_time_format ();
@@ -93,8 +97,9 @@ class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
/*** GUI components ***/
- Gtk::HBox option_hbox;
- Gtk::Label time_format_label;
+ Gtk::HBox option_hbox;
+ Gtk::Label time_format_label;
+ Gtk::CheckButton realtime_checkbutton;
/* Time format */
@@ -120,10 +125,11 @@ class ExportTimespanSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
Gtk::TreeModelColumn<ARDOUR::Location *> location;
Gtk::TreeModelColumn<std::string> label;
Gtk::TreeModelColumn<bool> selected;
+ Gtk::TreeModelColumn<bool> realtime;
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<std::string> length;
- RangeCols () { add (location); add(label); add(selected); add(name); add(length); }
+ RangeCols () { add (location); add(label); add(selected); add(realtime); add(name); add(length); }
};
RangeCols range_cols;
@@ -139,6 +145,8 @@ class ExportTimespanSelectorMultiple : public ExportTimespanSelector
public:
ExportTimespanSelectorMultiple (ARDOUR::Session * session, ProfileManagerPtr manager);
+ void allow_realtime_export (bool);
+
private:
virtual void fill_range_list ();
@@ -154,9 +162,12 @@ class ExportTimespanSelectorSingle : public ExportTimespanSelector
public:
ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, std::string range_id);
+ void allow_realtime_export (bool);
+
private:
virtual void fill_range_list ();
+ void update_timespans ();
std::string range_id;