summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-03-15 02:31:09 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-03-15 02:31:09 +0000
commit730937dc37237c580238171f30e1c02243b8f758 (patch)
tree37b8e129b12bcc81c4613c885bd1b6cb614003ba
parent86a0fe1b43432bc56f24644ec06d8e2d214cc8d5 (diff)
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
-rw-r--r--libs/ardour/ardour/io_processor.h2
-rw-r--r--libs/ardour/ardour/port_insert.h3
-rw-r--r--libs/ardour/ardour/return.h3
-rw-r--r--libs/ardour/ardour/send.h2
-rw-r--r--libs/ardour/io_processor.cc19
-rw-r--r--libs/ardour/port_insert.cc23
-rw-r--r--libs/ardour/return.cc23
-rw-r--r--libs/ardour/send.cc32
8 files changed, 22 insertions, 85 deletions
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<IO> _input;
boost::shared_ptr<IO> _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<Pannable>, boost::shared_ptr<MuteMaster> mm);
- PortInsert (Session&, const std::string&, uint32_t bitslot,
- boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster> 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> pannable, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send);
- Send (Session&, const std::string& name, uint32_t bitslot, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster>, 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<AutomationControl>) 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> pannable, boost:
_measured_latency = 0;
}
-PortInsert::PortInsert (Session& s, const std::string& name, uint32_t bslot, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster> 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<Pannable> p, boost::shared_ptr<MuteMas
add_control (_amp->gain_control ());
}
-Send::Send (Session& s, const std::string& name, uint32_t bslot, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMaster> 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)
{