X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fio_processor.cc;h=6a6f09bbe21b5787f11d9a3ef215d0b0d394a330;hb=79621762193a7a56cbb5a966cc8603c1d1c5e17c;hp=1408cdcafbee210fa492ad4d049f0e48b0f9eaed;hpb=e488378d42777b436c6a2708d9dff2def51a5271;p=ardour.git diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 1408cdcafb..6a6f09bbe2 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 @@ -17,26 +17,20 @@ */ -#include -#include +#include #include -#include -#include -#include - -#include #include "pbd/xml++.h" #include "pbd/enumwriter.h" -#include "ardour/io_processor.h" -#include "ardour/session.h" -#include "ardour/utils.h" -#include "ardour/send.h" -#include "ardour/port_insert.h" -#include "ardour/plugin_insert.h" +#include "ardour/chan_count.h" +#include "ardour/data_type.h" #include "ardour/io.h" +#include "ardour/io_processor.h" +#include "ardour/processor.h" #include "ardour/route.h" +#include "ardour/session_object.h" +#include "ardour/types.h" #include "i18n.h" @@ -44,10 +38,12 @@ using namespace std; using namespace ARDOUR; using namespace PBD; +namespace ARDOUR { class Session; } + /* create an IOProcessor that proxies to a new IO object */ IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output, - const string& proc_name, const string io_name, DataType dtype) + const string& proc_name, const string io_name, DataType dtype, bool sendish) : Processor(s, proc_name) { /* these are true in this constructor whether we actually create the associated @@ -58,17 +54,17 @@ IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output, _own_output = true; if (with_input) { - _input.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Input, dtype)); + _input.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Input, dtype, sendish)); } if (with_output) { - _output.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Output, dtype)); + _output.reset (new IO(s, io_name.empty() ? proc_name : io_name, IO::Output, dtype, sendish)); } } /* 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 +85,6 @@ IOProcessor::IOProcessor (Session& s, boost::shared_ptr in, boost::shared_pt IOProcessor::~IOProcessor () { - notify_callbacks (); } void @@ -114,7 +109,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 +123,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,12 +141,17 @@ IOProcessor::state (bool full_state) } int -IOProcessor::set_state (const XMLNode& node) +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; - Processor::set_state(node); + Processor::set_state(node, version); + if ((prop = node.property ("own-input")) != 0) { _own_input = string_is_affirmative (prop->value()); @@ -166,60 +165,96 @@ IOProcessor::set_state (const XMLNode& node) XMLNodeList nlist = node.children(); XMLNodeIterator niter; - - if (_own_input) { + const string instr = enum_2_string (IO::Input); + const string outstr = enum_2_string (IO::Output); + + if (_own_input && _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) { + + if (_own_output && _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 */ } } 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) +IOProcessor::silence (framecnt_t nframes) { if (_own_output && _output) { _output->silence (nframes); } } +void +IOProcessor::increment_port_buffer_offset (pframes_t offset) +{ + if (_own_output && _output) { + _output->increment_port_buffer_offset (offset); + } +} + ChanCount IOProcessor::natural_output_streams() const { @@ -265,3 +300,21 @@ IOProcessor::disconnect () _output->disconnect (this); } } + +/** Set up the XML description of a send so that we will not + * reset its name or bitslot during ::set_state() + * @param state XML send state. + * @param session Session. + */ +void +IOProcessor::prepare_for_reset (XMLNode &state, const std::string& name) +{ + state.add_property ("ignore-bitslot", "1"); + state.add_property ("ignore-name", "1"); + + XMLNode* io_node = state.child (IO::state_node_name.c_str()); + + if (io_node) { + IO::prepare_for_reset (*io_node, name); + } +}