export RT support as Timespan option

This commit is contained in:
Robin Gareus 2016-07-16 02:15:56 +02:00
parent bd50bfa967
commit 15433457f2
5 changed files with 182 additions and 29 deletions

View File

@ -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();

View File

@ -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
@ -245,6 +251,47 @@ ExportDialog::update_warnings_and_example_filename ()
file_notebook->update_example_filenames();
}
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 ()
{
@ -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);

View File

@ -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 ();

View File

@ -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);
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);
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);
}
@ -167,6 +178,30 @@ ExportTimespanSelector::sync_with_manager ()
CriticalSelectionChanged();
}
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 ()
{
@ -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));
}
@ -375,10 +415,18 @@ ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * se
range_view.append_column (_("Length"), range_cols.length);
}
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));
}
@ -437,10 +506,18 @@ ExportTimespanSelectorMultiple::ExportTimespanSelectorMultiple (ARDOUR::Session
range_view.append_column (_("Length"), range_cols.length);
}
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);
}

View File

@ -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;