From 9a3734a6bd0450faf92a8b1add2d5e052a4534ca Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 14 Feb 2009 19:45:30 +0000 Subject: Make DnD copy processors using their XML representations. Remove unused copy constructors from the Processor hierarchy, and declare them private to explicitly disallow copy construction. git-svn-id: svn://localhost/ardour2/branches/3.0@4556 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/io_processor.h | 6 ++- libs/ardour/ardour/meter.h | 2 + libs/ardour/ardour/panner.h | 3 ++ libs/ardour/ardour/plugin_insert.h | 3 +- libs/ardour/ardour/port_insert.h | 4 +- libs/ardour/ardour/processor.h | 6 ++- libs/ardour/ardour/route.h | 1 - libs/ardour/ardour/send.h | 4 +- libs/ardour/plugin_insert.cc | 17 -------- libs/ardour/port_insert.cc | 7 ---- libs/ardour/processor.cc | 21 ---------- libs/ardour/route.cc | 81 -------------------------------------- libs/ardour/send.cc | 36 ----------------- 13 files changed, 22 insertions(+), 169 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index af11e8cacf..985a2c387c 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -48,7 +48,6 @@ class IOProcessor : public Processor IOProcessor (Session&, const string& name, Placement, int input_min = -1, int input_max = -1, int output_min = -1, int output_max = -1, ARDOUR::DataType default_type = DataType::AUDIO); - IOProcessor (const IOProcessor&); virtual ~IOProcessor (); virtual ChanCount output_streams() const; @@ -74,6 +73,11 @@ class IOProcessor : public Processor protected: boost::shared_ptr _io; + + private: + /* disallow copy construction */ + IOProcessor (const IOProcessor&); + }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h index 112f306ccb..2cf474afba 100644 --- a/libs/ardour/ardour/meter.h +++ b/libs/ardour/ardour/meter.h @@ -63,6 +63,8 @@ public: } private: + /* disallow copy construction */ + PeakMeter (PeakMeter const &); friend class IO; void meter(); diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h index 34b99e63bf..f6839f6d29 100644 --- a/libs/ardour/ardour/panner.h +++ b/libs/ardour/ardour/panner.h @@ -298,6 +298,9 @@ class Panner : public Processor } private: + /* disallow copy construction */ + Panner (Panner const &); + void distribute_no_automation(BufferSet& src, BufferSet& dest, nframes_t nframes, nframes_t offset, gain_t gain_coeff); std::vector _streampanners; uint32_t current_outs; diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 2583728ef3..ee5c7405fb 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -46,7 +46,6 @@ class PluginInsert : public Processor public: PluginInsert (Session&, boost::shared_ptr, Placement); PluginInsert (Session&, const XMLNode&); - PluginInsert (const PluginInsert&); ~PluginInsert (); static const string port_automation_node_name; @@ -117,6 +116,8 @@ class PluginInsert : public Processor } private: + /* disallow copy construction */ + PluginInsert (const PluginInsert&); void parameter_changed (Evoral::Parameter, float); diff --git a/libs/ardour/ardour/port_insert.h b/libs/ardour/ardour/port_insert.h index 55f91569d5..78ff09124b 100644 --- a/libs/ardour/ardour/port_insert.h +++ b/libs/ardour/ardour/port_insert.h @@ -42,7 +42,6 @@ class PortInsert : public IOProcessor public: PortInsert (Session&, Placement); PortInsert (Session&, const XMLNode&); - PortInsert (const PortInsert&); ~PortInsert (); XMLNode& state(bool full); @@ -64,6 +63,9 @@ class PortInsert : public IOProcessor uint32_t bit_slot() const { return bitslot; } private: + /* disallow copy construction */ + PortInsert (const PortInsert&); + uint32_t bitslot; }; diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 5a1011966c..83d6be0df9 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -53,8 +53,6 @@ class Processor : public SessionObject, public AutomatableControls, public Laten virtual ~Processor() { } - static boost::shared_ptr clone (boost::shared_ptr); - uint32_t sort_key() const { return _sort_key; } void set_sort_key (uint32_t key); @@ -117,6 +115,10 @@ protected: Placement _placement; uint32_t _sort_key; void* _gui; /* generic, we don't know or care what this is */ + +private: + /* disallow copy construction */ + Processor (Processor const &); }; } // namespace ARDOUR diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index cbf4910899..5e83bd2f1e 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -176,7 +176,6 @@ class Route : public IO int add_processor (boost::shared_ptr, ProcessorStreams* err = 0); int add_processors (const ProcessorList&, ProcessorStreams* err = 0); int remove_processor (boost::shared_ptr, ProcessorStreams* err = 0); - int copy_processors (const Route&, Placement, ProcessorStreams* err = 0); int sort_processors (ProcessorStreams* err = 0); void disable_processors (Placement); void disable_processors (); diff --git a/libs/ardour/ardour/send.h b/libs/ardour/ardour/send.h index b65675dc2c..dc1cbb8209 100644 --- a/libs/ardour/ardour/send.h +++ b/libs/ardour/ardour/send.h @@ -36,7 +36,6 @@ class Send : public IOProcessor public: Send (Session&, Placement); Send (Session&, const XMLNode&); - Send (const Send&); virtual ~Send (); uint32_t bit_slot() const { return bitslot; } @@ -65,6 +64,9 @@ class Send : public IOProcessor static void make_unique (XMLNode &, Session &); private: + /* disallow copy construction */ + Send (const Send&); + bool _metering; ChanCount expected_inputs; uint32_t bitslot; diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 431c91762e..2256afb782 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -96,23 +96,6 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node) } } -PluginInsert::PluginInsert (const PluginInsert& other) - : Processor (other._session, other._name, other.placement()), - _signal_analysis_collected_nframes(0), - _signal_analysis_collect_nframes_max(0) -{ - uint32_t count = other._plugins.size(); - - /* make as many copies as requested */ - for (uint32_t n = 0; n < count; ++n) { - _plugins.push_back (plugin_factory (other.plugin (n))); - } - - init (); - - ProcessorCreated (this); /* EMIT SIGNAL */ -} - bool PluginInsert::set_count (uint32_t num) { diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index 2e7f20ba66..cbbf66b40f 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -47,13 +47,6 @@ PortInsert::PortInsert (Session& s, Placement p) ProcessorCreated (this); /* EMIT SIGNAL */ } -PortInsert::PortInsert (const PortInsert& other) - : IOProcessor (other._session, string_compose (_("insert %1"), (bitslot = other._session.next_insert_id()) + 1), other.placement(), 1, -1, 1, -1) -{ - init (); - ProcessorCreated (this); /* EMIT SIGNAL */ -} - void PortInsert::init () { diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index a528a4587c..085a27b581 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -69,27 +69,6 @@ Processor::Processor(Session& session, const string& name, Placement p) { } -boost::shared_ptr -Processor::clone (boost::shared_ptr other) -{ - boost::shared_ptr send; - boost::shared_ptr port_insert; - boost::shared_ptr plugin_insert; - - if ((send = boost::dynamic_pointer_cast(other)) != 0) { - return boost::shared_ptr (new Send (*send)); - } else if ((port_insert = boost::dynamic_pointer_cast(other)) != 0) { - return boost::shared_ptr (new PortInsert (*port_insert)); - } else if ((plugin_insert = boost::dynamic_pointer_cast(other)) != 0) { - return boost::shared_ptr (new PluginInsert (*plugin_insert)); - } else { - fatal << _("programming error: unknown Processor type in Processor::Clone!\n") - << endmsg; - /*NOTREACHED*/ - } - return boost::shared_ptr(); -} - void Processor::set_sort_key (uint32_t key) { diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 6f031acd12..21b7876aca 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -1762,87 +1762,6 @@ Route::check_some_processor_counts (list& iclist, ChanCount requ return false; } -int -Route::copy_processors (const Route& other, Placement placement, ProcessorStreams* err) -{ - ChanCount old_pmo = processor_max_outs; - - ProcessorList to_be_deleted; - - { - Glib::RWLock::WriterLock lm (_processor_lock); - ProcessorList::iterator tmp; - ProcessorList the_copy; - - the_copy = _processors; - - /* remove all relevant processors */ - - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ) { - tmp = i; - ++tmp; - - if ((*i)->placement() == placement) { - to_be_deleted.push_back (*i); - _processors.erase (i); - } - - i = tmp; - } - - /* now copy the relevant ones from "other" */ - - for (ProcessorList::const_iterator i = other._processors.begin(); i != other._processors.end(); ++i) { - if ((*i)->placement() == placement) { - _processors.push_back (IOProcessor::clone (*i)); - } - } - - /* reset plugin stream handling */ - - if (_reset_processor_counts (err)) { - - /* FAILED COPY ATTEMPT: we have to restore order */ - - /* delete all cloned processors */ - - for (ProcessorList::iterator i = _processors.begin(); i != _processors.end(); ) { - - tmp = i; - ++tmp; - - if ((*i)->placement() == placement) { - _processors.erase (i); - } - - i = tmp; - } - - /* restore the natural order */ - - _processors = the_copy; - processor_max_outs = old_pmo; - - /* we failed, even though things are OK again */ - - return -1; - - } else { - - /* SUCCESSFUL COPY ATTEMPT: delete the processors we removed pre-copy */ - to_be_deleted.clear (); - _user_latency = 0; - } - } - - if (processor_max_outs != old_pmo || old_pmo == ChanCount::ZERO) { - reset_panner (); - } - - processors_changed (); /* EMIT SIGNAL */ - return 0; -} - void Route::all_processors_flip () { diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 252ca691be..bdd75494fb 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -54,42 +54,6 @@ Send::Send (Session& s, const XMLNode& node) ProcessorCreated (this); /* EMIT SIGNAL */ } -Send::Send (const Send& other) - : IOProcessor (other._session, string_compose (_("send %1"), (bitslot = other._session.next_send_id()) + 1), other.placement()) -{ - _metering = false; - - expected_inputs.set (DataType::AUDIO, 0); - - /* set up the same outputs, and connect them to the same places */ - - _io->defer_pan_reset (); - - for (uint32_t i = 0; i < other._io->n_outputs().get (_io->default_type()); ++i) { - _io->add_output_port ("", 0); - Port* p = other._io->output (i); - if (p) { - /* this is what the other send's output is connected to */ - std::vector connections; - p->get_connections (connections); - for (uint32_t j = 0; j < connections.size(); ++j) { - _io->connect_output (_io->output (i), connections[j], 0); - } - } - } - - /* setup panner */ - - _io->allow_pan_reset (); - - XMLNode& other_state (other._io->panner().get_state ()); - _io->panner().set_state (other_state); - - delete &other_state; - - ProcessorCreated (this); /* EMIT SIGNAL */ -} - Send::~Send () { GoingAway (); -- cgit v1.2.3