Store Region export state in instant.xml (fixes #3935)

git-svn-id: svn://localhost/ardour2/branches/3.0@11376 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sakari Bergen 2012-01-28 15:05:53 +00:00
parent aaf418bd6f
commit ab8cea1d7c
6 changed files with 57 additions and 8 deletions

View file

@ -478,6 +478,24 @@ void
RegionExportChannelSelector::sync_with_manager () RegionExportChannelSelector::sync_with_manager ()
{ {
state = manager->get_channel_configs().front(); state = manager->get_channel_configs().front();
if (!state) { return; }
switch (state->config->region_processing_type()) {
case RegionExportChannelFactory::None:
// Do nothing
break;
case RegionExportChannelFactory::Raw:
raw_button.set_active (true);
break;
case RegionExportChannelFactory::Fades:
fades_button.set_active (true);
break;
case RegionExportChannelFactory::Processed:
processed_button.set_active (true);
break;
}
handle_selection (); handle_selection ();
} }
@ -490,17 +508,21 @@ RegionExportChannelSelector::handle_selection ()
state->config->clear_channels (); state->config->clear_channels ();
RegionExportChannelFactory::Type type = RegionExportChannelFactory::None;
if (raw_button.get_active ()) { if (raw_button.get_active ()) {
factory.reset (new RegionExportChannelFactory (_session, region, track, RegionExportChannelFactory::Raw)); type = RegionExportChannelFactory::Raw;
} else if (fades_button.get_active ()) { } else if (fades_button.get_active ()) {
factory.reset (new RegionExportChannelFactory (_session, region, track, RegionExportChannelFactory::Fades)); type = RegionExportChannelFactory::Fades;
} else if (processed_button.get_active ()) { } else if (processed_button.get_active ()) {
factory.reset (new RegionExportChannelFactory(_session, region, track, RegionExportChannelFactory::Processed)); type = RegionExportChannelFactory::Processed;
} else { } else {
CriticalSelectionChanged (); CriticalSelectionChanged ();
return; return;
} }
factory.reset (new RegionExportChannelFactory (_session, region, track, type));
state->config->set_region_processing_type (type);
for (size_t chan = 0; chan < region_chans; ++chan) { for (size_t chan = 0; chan < region_chans; ++chan) {
state->config->register_channel (factory->create (chan)); state->config->register_channel (factory->create (chan));
} }

View file

@ -93,6 +93,7 @@ class RegionExportChannelFactory
{ {
public: public:
enum Type { enum Type {
None,
Raw, Raw,
Fades, Fades,
Processed Processed

View file

@ -68,6 +68,9 @@ class ExportChannelConfiguration : public boost::enable_shared_from_this<ExportC
void set_name (std::string name) { _name = name; } void set_name (std::string name) { _name = name; }
void set_split (bool value) { split = value; } void set_split (bool value) { split = value; }
RegionExportChannelFactory::Type region_processing_type() const { return region_type; }
void set_region_processing_type(RegionExportChannelFactory::Type type) { region_type = type; }
bool get_split () const { return split; } bool get_split () const { return split; }
uint32_t get_n_chans () const { return channels.size(); } uint32_t get_n_chans () const { return channels.size(); }
@ -88,6 +91,7 @@ class ExportChannelConfiguration : public boost::enable_shared_from_this<ExportC
ChannelList channels; ChannelList channels;
bool split; // Split to mono files bool split; // Split to mono files
std::string _name; std::string _name;
RegionExportChannelFactory::Type region_type;
}; };
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -27,6 +27,7 @@
#include "ardour/export_filename.h" #include "ardour/export_filename.h"
#include "ardour/export_format_base.h" #include "ardour/export_format_base.h"
#include "ardour/export_profile_manager.h" #include "ardour/export_profile_manager.h"
#include "ardour/export_channel_configuration.h"
#include "ardour/io.h" #include "ardour/io.h"
#include "ardour/location.h" #include "ardour/location.h"
#include "ardour/midi_model.h" #include "ardour/midi_model.h"
@ -112,6 +113,7 @@ setup_enum_writer ()
ExportFormatBase::SampleRate _ExportFormatBase_SampleRate; ExportFormatBase::SampleRate _ExportFormatBase_SampleRate;
ExportFormatBase::SRCQuality _ExportFormatBase_SRCQuality; ExportFormatBase::SRCQuality _ExportFormatBase_SRCQuality;
ExportProfileManager::TimeFormat _ExportProfileManager_TimeFormat; ExportProfileManager::TimeFormat _ExportProfileManager_TimeFormat;
RegionExportChannelFactory::Type _RegionExportChannelFactory_Type;
Delivery::Role _Delivery_Role; Delivery::Role _Delivery_Role;
IO::Direction _IO_Direction; IO::Direction _IO_Direction;
MuteMaster::MutePoint _MuteMaster_MutePoint; MuteMaster::MutePoint _MuteMaster_MutePoint;
@ -529,6 +531,12 @@ setup_enum_writer ()
REGISTER_CLASS_ENUM (ExportProfileManager, Frames); REGISTER_CLASS_ENUM (ExportProfileManager, Frames);
REGISTER (_ExportProfileManager_TimeFormat); REGISTER (_ExportProfileManager_TimeFormat);
REGISTER_CLASS_ENUM (RegionExportChannelFactory, None);
REGISTER_CLASS_ENUM (RegionExportChannelFactory, Raw);
REGISTER_CLASS_ENUM (RegionExportChannelFactory, Fades);
REGISTER_CLASS_ENUM (RegionExportChannelFactory, Processed);
REGISTER (_RegionExportChannelFactory_Type);
REGISTER_CLASS_ENUM (Delivery, Insert); REGISTER_CLASS_ENUM (Delivery, Insert);
REGISTER_CLASS_ENUM (Delivery, Send); REGISTER_CLASS_ENUM (Delivery, Send);
REGISTER_CLASS_ENUM (Delivery, Listen); REGISTER_CLASS_ENUM (Delivery, Listen);

View file

@ -31,6 +31,7 @@
#include "ardour/audioengine.h" #include "ardour/audioengine.h"
#include "pbd/convert.h" #include "pbd/convert.h"
#include "pbd/enumwriter.h"
#include "pbd/pthread_utils.h" #include "pbd/pthread_utils.h"
using namespace PBD; using namespace PBD;
@ -40,9 +41,10 @@ namespace ARDOUR
/* ExportChannelConfiguration */ /* ExportChannelConfiguration */
ExportChannelConfiguration::ExportChannelConfiguration (Session & session) : ExportChannelConfiguration::ExportChannelConfiguration (Session & session)
session (session), : session (session)
split (false) , split (false)
, region_type (RegionExportChannelFactory::None)
{ {
} }
@ -56,6 +58,15 @@ ExportChannelConfiguration::get_state ()
root->add_property ("split", get_split() ? "true" : "false"); root->add_property ("split", get_split() ? "true" : "false");
root->add_property ("channels", to_string (get_n_chans(), std::dec)); root->add_property ("channels", to_string (get_n_chans(), std::dec));
switch (region_type) {
case RegionExportChannelFactory::None:
// Do nothing
break;
default:
root->add_property ("region-processing", enum_2_string (region_type));
break;
}
uint32_t i = 1; uint32_t i = 1;
for (ExportChannelConfiguration::ChannelList::const_iterator c_it = channels.begin(); c_it != channels.end(); ++c_it) { for (ExportChannelConfiguration::ChannelList::const_iterator c_it = channels.begin(); c_it != channels.end(); ++c_it) {
channel = root->add_child ("Channel"); channel = root->add_child ("Channel");
@ -79,6 +90,11 @@ ExportChannelConfiguration::set_state (const XMLNode & root)
set_split (!prop->value().compare ("true")); set_split (!prop->value().compare ("true"));
} }
if ((prop = root.property ("region-processing"))) {
set_region_processing_type ((RegionExportChannelFactory::Type)
string_2_enum (prop->value(), RegionExportChannelFactory::Type));
}
XMLNodeList channels = root.children ("Channel"); XMLNodeList channels = root.children ("Channel");
for (XMLNodeList::iterator it = channels.begin(); it != channels.end(); ++it) { for (XMLNodeList::iterator it = channels.begin(); it != channels.end(); ++it) {
ExportChannelPtr channel (new PortExportChannel ()); ExportChannelPtr channel (new PortExportChannel ());

View file

@ -90,8 +90,6 @@ ExportProfileManager::ExportProfileManager (Session & s, std::string xml_node_na
ExportProfileManager::~ExportProfileManager () ExportProfileManager::~ExportProfileManager ()
{ {
if (single_range_mode) { return; }
XMLNode * instant_xml (new XMLNode (xml_node_name)); XMLNode * instant_xml (new XMLNode (xml_node_name));
serialize_profile (*instant_xml); serialize_profile (*instant_xml);
session.add_instant_xml (*instant_xml, false); session.add_instant_xml (*instant_xml, false);