X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fio_processor.cc;h=d1b7e9c232103d6c63e7adcb90438ea9efc66142;hb=1c1b359ff21aac57bd71d291049d657f66cf31f5;hp=505d33a1b09b360fd2e55d42e42c233335f20da8;hpb=0bf3eb77591afc4aa8d0d6b5efa72273f02b109e;p=ardour.git diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 505d33a1b0..d1b7e9c232 100644 --- a/libs/ardour/io_processor.cc +++ b/libs/ardour/io_processor.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,6 @@ #include #include -#include #include "pbd/xml++.h" #include "pbd/enumwriter.h" @@ -68,7 +67,7 @@ IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output, /* create an IOProcessor that proxies to an existing IO object */ -IOProcessor::IOProcessor (Session& s, boost::shared_ptr in, boost::shared_ptr out, +IOProcessor::IOProcessor (Session& s, boost::shared_ptr in, boost::shared_ptr out, const string& proc_name, DataType /*dtype*/) : Processor(s, proc_name) , _input (in) @@ -89,7 +88,6 @@ IOProcessor::IOProcessor (Session& s, boost::shared_ptr in, boost::shared_pt IOProcessor::~IOProcessor () { - notify_callbacks (); } void @@ -114,7 +112,7 @@ XMLNode& IOProcessor::state (bool full_state) { XMLNode& node (Processor::state (full_state)); - + if (_own_input) { node.add_property ("own-input", "yes"); if (_input) { @@ -128,12 +126,11 @@ IOProcessor::state (bool full_state) node.add_property ("input", _input->name()); } } - + if (_own_output) { node.add_property ("own-output", "yes"); if (_output) { XMLNode& o (_output->state (full_state)); - // o.name() = X_("output"); node.add_child_nocopy (o); } } else { @@ -147,65 +144,83 @@ IOProcessor::state (bool full_state) } int -IOProcessor::set_state (const XMLNode& node) +IOProcessor::set_state (const XMLNode& node, int version) { const XMLProperty *prop; const XMLNode *io_node = 0; - Processor::set_state(node); + Processor::set_state(node, version); if ((prop = node.property ("own-input")) != 0) { - _own_input = (prop->value() == "yes"); + _own_input = string_is_affirmative (prop->value()); } if ((prop = node.property ("own-output")) != 0) { - _own_output = (prop->value() == "yes"); + _own_output = string_is_affirmative (prop->value()); } /* don't attempt to set state for a proxied IO that we don't own */ XMLNodeList nlist = node.children(); XMLNodeIterator niter; - + const string instr = enum_2_string (IO::Input); + const string outstr = enum_2_string (IO::Output); + if (_own_input) { for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == "input") { - io_node = (*niter); - break; + const XMLProperty* prop; + if ((prop = (*niter)->property ("name")) != 0) { + if (_name == prop->value()) { + if ((prop = (*niter)->property ("direction")) != 0) { + if (prop->value() == instr) { + io_node = (*niter); + break; + } + } + } } } - + if (io_node) { - _input->set_state(*io_node); - + _input->set_state(*io_node, version); + // legacy sessions: use IO name if ((prop = node.property ("name")) == 0) { set_name (_input->name()); } - + } else { - /* no input */ + /* no input, which is OK */ } } - + if (_own_output) { for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == "output") { - io_node = (*niter); - break; + if ((*niter)->name() == "IO") { + const XMLProperty* prop; + if ((prop = (*niter)->property ("name")) != 0) { + if (_name == prop->value()) { + if ((prop = (*niter)->property ("direction")) != 0) { + if (prop->value() == outstr) { + io_node = (*niter); + break; + } + } + } + } } } - + if (io_node) { - _output->set_state(*io_node); - + _output->set_state(*io_node, version); + // legacy sessions: use IO name if ((prop = node.property ("name")) == 0) { set_name (_output->name()); } } else { - /* no output */ + /* no output, which is OK */ } }