summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-09-03 15:34:09 +0000
committerCarl Hetherington <carl@carlh.net>2010-09-03 15:34:09 +0000
commit5b90aab4d8837316fc5835083999747c56f24d58 (patch)
treed631d6591ade721f57f32c567a1f1529af8114fe /libs/ardour
parent8778724701ac14ebb02fe46dd3dc71eef38b636a (diff)
Fix restore of sends from session files for both 2.X and 3.0 sessions. Fixes #3433.
git-svn-id: svn://localhost/ardour2/branches/3.0@7739 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/io_processor.h3
-rw-r--r--libs/ardour/ardour/processor.h5
-rw-r--r--libs/ardour/ardour/route.h3
-rw-r--r--libs/ardour/ardour/send.h2
-rw-r--r--libs/ardour/delivery.cc3
-rw-r--r--libs/ardour/io_processor.cc14
-rw-r--r--libs/ardour/route.cc36
-rw-r--r--libs/ardour/send.cc43
8 files changed, 88 insertions, 21 deletions
diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h
index 2acf7337a7..7d1854ced0 100644
--- a/libs/ardour/ardour/io_processor.h
+++ b/libs/ardour/ardour/io_processor.h
@@ -80,6 +80,9 @@ class IOProcessor : public Processor
private:
/* disallow copy construction */
IOProcessor (const IOProcessor&);
+
+ virtual int set_state_2X (const XMLNode &, int);
+
bool _own_input;
bool _own_output;
diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h
index fe1b4bb6cd..09505e3f72 100644
--- a/libs/ardour/ardour/processor.h
+++ b/libs/ardour/ardour/processor.h
@@ -99,6 +99,8 @@ class Processor : public SessionObject, public Automatable, public Latent
PBD::Signal2<void,ChanCount,ChanCount> ConfigurationChanged;
protected:
+ virtual int set_state_2X (const XMLNode&, int version);
+
int _pending_active;
bool _active;
bool _next_ab_is_active;
@@ -107,9 +109,6 @@ protected:
ChanCount _configured_output;
bool _display_to_user;
bool _pre_fader;
-
-private:
- int set_state_2X (const XMLNode&, int version);
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index c4ea180954..b49cb77788 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -477,8 +477,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
int configure_processors_unlocked (ProcessorStreams*);
- bool add_processor_from_xml (const XMLNode&, ProcessorList::iterator iter);
- bool add_processor_from_xml_2X (const XMLNode&, int, ProcessorList::iterator iter);
+ bool add_processor_from_xml_2X (const XMLNode&, int);
void placement_range (Placement p, ProcessorList::iterator& start, ProcessorList::iterator& end);
diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h
index af806b3c1f..29b6dcbf64 100644
--- a/libs/ardour/ardour/send.h
+++ b/libs/ardour/ardour/send.h
@@ -77,6 +77,8 @@ class Send : public Delivery
/* disallow copy construction */
Send (const Send&);
+ int set_state_2X (XMLNode const &, int);
+
uint32_t _bitslot;
};
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index 77e3104bd6..e93e550308 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -209,8 +209,9 @@ Delivery::configure_io (ChanCount in, ChanCount out)
}
}
}
- }
+ }
+
if (!Processor::configure_io (in, out)) {
return false;
}
diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc
index d1b7e9c232..877e0422fa 100644
--- a/libs/ardour/io_processor.cc
+++ b/libs/ardour/io_processor.cc
@@ -146,6 +146,10 @@ IOProcessor::state (bool full_state)
int
IOProcessor::set_state (const XMLNode& node, int version)
{
+ if (version < 3000) {
+ return set_state_2X (node, version);
+ }
+
const XMLProperty *prop;
const XMLNode *io_node = 0;
@@ -227,6 +231,16 @@ IOProcessor::set_state (const XMLNode& node, int version)
return 0;
}
+int
+IOProcessor::set_state_2X (const XMLNode& node, int version)
+{
+ _own_input = _own_output = true;
+
+ Processor::set_state_2X (node, version);
+
+ return 0;
+}
+
void
IOProcessor::silence (nframes_t nframes)
{
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 35c456622c..72db9a3914 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -918,13 +918,31 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite
}
bool
-Route::add_processor_from_xml_2X (const XMLNode& node, int version, ProcessorList::iterator iter)
+Route::add_processor_from_xml_2X (const XMLNode& node, int version)
{
const XMLProperty *prop;
try {
boost::shared_ptr<Processor> processor;
+ /* bit of a hack: get the `placement' property from the <Redirect> tag here
+ so that we can add the processor in the right place (pre/post-fader)
+ */
+
+ XMLNodeList const & children = node.children ();
+ XMLNodeList::const_iterator i = children.begin ();
+ while (i != children.end() && (*i)->name() != X_("Redirect")) {
+ ++i;
+ }
+
+ Placement placement = PreFader;
+
+ if (i != children.end()) {
+ if ((prop = node.property (X_("placement"))) != 0) {
+ placement = Placement (string_2_enum (prop->value(), placement));
+ }
+ }
+
if (node.name() == "Insert") {
if ((prop = node.property ("type")) != 0) {
@@ -957,19 +975,7 @@ Route::add_processor_from_xml_2X (const XMLNode& node, int version, ProcessorLis
return false;
}
- if (iter == _processors.end() && processor->display_to_user() && !_processors.empty()) {
- /* check for invisible processors stacked at the end and leave them there */
- ProcessorList::iterator p;
- p = _processors.end();
- --p;
- while (!(*p)->display_to_user() && p != _processors.begin()) {
- --p;
- }
- ++p;
- iter = p;
- }
-
- return (add_processor (processor, iter) == 0);
+ return (add_processor (processor, placement) == 0);
}
catch (failed_constructor &err) {
@@ -2245,7 +2251,7 @@ Route::set_processor_state_2X (XMLNodeList const & nList, int version)
*/
for (XMLNodeConstIterator i = nList.begin(); i != nList.end(); ++i) {
- add_processor_from_xml_2X (**i, version, _processors.begin ());
+ add_processor_from_xml_2X (**i, version);
}
}
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index 9d5d2398c7..48083d594a 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -139,6 +139,10 @@ Send::state (bool full)
int
Send::set_state (const XMLNode& node, int version)
{
+ if (version < 3000) {
+ return set_state_2X (node, version);
+ }
+
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
const XMLProperty* prop;
@@ -162,6 +166,41 @@ Send::set_state (const XMLNode& node, int version)
return 0;
}
+int
+Send::set_state_2X (const XMLNode& node, int version)
+{
+ /* use the IO's name for the name of the send */
+ XMLNodeList const & children = node.children ();
+
+ XMLNodeList::const_iterator i = children.begin();
+ while (i != children.end() && (*i)->name() != X_("Redirect")) {
+ ++i;
+ }
+
+ if (i == children.end()) {
+ return -1;
+ }
+
+ XMLNodeList const & grand_children = (*i)->children ();
+ XMLNodeList::const_iterator j = grand_children.begin ();
+ while (j != grand_children.end() && (*j)->name() != X_("IO")) {
+ ++j;
+ }
+
+ if (j == grand_children.end()) {
+ return -1;
+ }
+
+ XMLProperty const * prop = (*j)->property X_("name");
+ if (!prop) {
+ return -1;
+ }
+
+ set_name (prop->value ());
+
+ return 0;
+}
+
bool
Send::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
{
@@ -180,6 +219,10 @@ Send::configure_io (ChanCount in, ChanCount out)
return false;
}
+ if (_output) {
+ _output->ensure_io (out, false, 0);
+ }
+
if (!Processor::configure_io (in, out)) {
return false;
}