13
0

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
This commit is contained in:
Carl Hetherington 2010-09-03 15:34:09 +00:00
parent 8778724701
commit 5b90aab4d8
8 changed files with 88 additions and 21 deletions

View File

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

View File

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

View File

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

View File

@ -77,6 +77,8 @@ class Send : public Delivery
/* disallow copy construction */
Send (const Send&);
int set_state_2X (XMLNode const &, int);
uint32_t _bitslot;
};

View File

@ -209,8 +209,9 @@ Delivery::configure_io (ChanCount in, ChanCount out)
}
}
}
}
}
if (!Processor::configure_io (in, out)) {
return false;
}

View File

@ -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)
{

View File

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

View File

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