From 730937dc37237c580238171f30e1c02243b8f758 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 15 Mar 2012 02:31:09 +0000 Subject: better, cleaner fix for copying sends/returns/port inserts via XML state git-svn-id: svn://localhost/ardour2/branches/3.0@11691 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/io_processor.h | 2 ++ libs/ardour/ardour/port_insert.h | 3 --- libs/ardour/ardour/return.h | 3 +-- libs/ardour/ardour/send.h | 2 -- libs/ardour/io_processor.cc | 19 +++++++++++++++++++ libs/ardour/port_insert.cc | 23 ----------------------- libs/ardour/return.cc | 23 ----------------------- libs/ardour/send.cc | 32 -------------------------------- 8 files changed, 22 insertions(+), 85 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index 4f7d1467c8..4385b1c041 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -75,6 +75,8 @@ class IOProcessor : public Processor XMLNode& state (bool full_state); int set_state (const XMLNode&, int version); + static void prepare_for_reset (XMLNode& state, const std::string& name); + protected: boost::shared_ptr _input; boost::shared_ptr _output; diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index f42294b2b4..657c2c0de6 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -45,8 +45,6 @@ class PortInsert : public IOProcessor { public: PortInsert (Session&, boost::shared_ptr, boost::shared_ptr mm); - PortInsert (Session&, const std::string&, uint32_t bitslot, - boost::shared_ptr, boost::shared_ptr mm); ~PortInsert (); XMLNode& state(bool full); @@ -74,7 +72,6 @@ class PortInsert : public IOProcessor void set_measured_latency (framecnt_t); framecnt_t latency () const; - static void make_unique (XMLNode &); static std::string name_and_id_new_insert (Session&, uint32_t&); private: diff --git a/libs/ardour/ardour/return.h b/libs/ardour/ardour/return.h index f41360b73b..55ca2d84f6 100644 --- a/libs/ardour/ardour/return.h +++ b/libs/ardour/ardour/return.h @@ -33,11 +33,11 @@ namespace ARDOUR { class Amp; class PeakMeter; + class Return : public IOProcessor { public: Return (Session&, bool internal = false); - Return (Session&, const std::string& name, uint32_t bslot, bool internal = false); virtual ~Return (); uint32_t bit_slot() const { return _bitslot; } @@ -60,7 +60,6 @@ public: bool configure_io (ChanCount in, ChanCount out); static uint32_t how_many_returns(); - static void make_unique (XMLNode &); static std::string name_and_id_new_return (Session&, uint32_t&); protected: diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index dce8fd31d5..fa023a3b68 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -36,7 +36,6 @@ class Send : public Delivery { public: Send (Session&, boost::shared_ptr pannable, boost::shared_ptr, Delivery::Role r = Delivery::Send); - Send (Session&, const std::string& name, uint32_t bitslot, boost::shared_ptr pannable, boost::shared_ptr, Delivery::Role r = Delivery::Send); virtual ~Send (); uint32_t bit_slot() const { return _bitslot; } @@ -68,7 +67,6 @@ class Send : public Delivery std::string value_as_string (boost::shared_ptr) const; static uint32_t how_many_sends(); - static void make_unique (XMLNode &); static std::string name_and_id_new_send (Session&, Delivery::Role r, uint32_t&); protected: diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 12ab63483c..e1d1461bcd 100644 --- a/libs/ardour/io_processor.cc +++ b/libs/ardour/io_processor.cc @@ -155,6 +155,7 @@ IOProcessor::set_state (const XMLNode& node, int version) Processor::set_state(node, version); + if ((prop = node.property ("own-input")) != 0) { _own_input = string_is_affirmative (prop->value()); } @@ -302,3 +303,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_node->add_property ("name", name); + } +} diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index 70f88e904f..cc27c6887f 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -58,17 +58,6 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr pannable, boost: _measured_latency = 0; } -PortInsert::PortInsert (Session& s, const std::string& name, uint32_t bslot, boost::shared_ptr pannable, boost::shared_ptr mm) - : IOProcessor (s, true, true, name, "") - , _out (new Delivery (s, _output, pannable, mm, _name, Delivery::Insert)) - , _bitslot (bslot) -{ - _mtdm = 0; - _latency_detect = false; - _latency_flush_frames = false; - _measured_latency = 0; -} - PortInsert::~PortInsert () { _session.unmark_insert_id (_bitslot); @@ -315,15 +304,3 @@ PortInsert::deactivate () _out->deactivate (); } - -/** Set up the XML description of a send so that we will not - * reset its name or bitslot during ::set_state() - * @param state XML insert state. - */ - -void -PortInsert::make_unique (XMLNode &state) -{ - state.add_property ("ignore-bitslot", "1"); - state.add_property ("ignore-name", "1"); -} diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc index 8433f7de08..0152155338 100644 --- a/libs/ardour/return.cc +++ b/libs/ardour/return.cc @@ -57,17 +57,6 @@ Return::Return (Session& s, bool internal) _meter.reset (new PeakMeter (_session)); } -Return::Return (Session& s, const std::string& name, uint32_t bslot, bool internal) - : IOProcessor (s, (internal ? false : true), false, name) - , _metering (false) - , _bitslot (bslot) -{ - /* never muted */ - - _amp.reset (new Amp (_session)); - _meter.reset (new PeakMeter (_session)); -} - Return::~Return () { _session.unmark_return_id (_bitslot); @@ -175,15 +164,3 @@ Return::configure_io (ChanCount in, ChanCount out) return true; } -/** Set up the XML description of a return so that we will not - * reset its name or bitslot during ::set_state() - * @param state XML return state. - */ -void -Return::make_unique (XMLNode &state) -{ - state.add_property ("ignore-bitslot", "1"); - state.add_property ("ignore-name", "1"); -} - - diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index ce48b2712b..819165b352 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -85,26 +85,6 @@ Send::Send (Session& s, boost::shared_ptr p, boost::shared_ptrgain_control ()); } -Send::Send (Session& s, const std::string& name, uint32_t bslot, boost::shared_ptr p, boost::shared_ptr mm, Role r) - : Delivery (s, p, mm, name, r) - , _metering (false) - , _bitslot (bslot) -{ - if (_role == Listen) { - /* we don't need to do this but it keeps things looking clean - in a debugger. _bitslot is not used by listen sends. - */ - _bitslot = 0; - } - - boost_debug_shared_ptr_mark_interesting (this, "send"); - - _amp.reset (new Amp (_session)); - _meter.reset (new PeakMeter (_session)); - - add_control (_amp->gain_control ()); -} - Send::~Send () { _session.unmark_send_id (_bitslot); @@ -315,18 +295,6 @@ Send::configure_io (ChanCount in, ChanCount out) return true; } -/** 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 -Send::make_unique (XMLNode &state) -{ - state.add_property ("ignore-bitslot", "1"); - state.add_property ("ignore-name", "1"); -} - bool Send::set_name (const string& new_name) { -- cgit v1.2.3