summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-24 14:01:31 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-24 14:01:31 +0000
commit2726184f42652a84816096887948658177ea24f8 (patch)
treea94ae006bedd134a762cd6ba2a1ab4d643b2f3be
parentb3a3e66f7755fe35ace4cbb6b19b54a52bb71a2f (diff)
remove XML-based constructors for several types of Processors; less debugging
git-svn-id: svn://localhost/ardour2/branches/3.0@6790 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/processor_box.cc19
-rw-r--r--libs/ardour/ardour/delivery.h2
-rw-r--r--libs/ardour/ardour/internal_return.h1
-rw-r--r--libs/ardour/ardour/internal_send.h3
-rw-r--r--libs/ardour/ardour/meter.h1
-rw-r--r--libs/ardour/ardour/monitor_processor.h1
-rw-r--r--libs/ardour/delivery.cc55
-rw-r--r--libs/ardour/internal_return.cc7
-rw-r--r--libs/ardour/internal_send.cc55
-rw-r--r--libs/ardour/meter.cc6
-rw-r--r--libs/ardour/monitor_processor.cc6
-rw-r--r--libs/ardour/return.cc16
-rw-r--r--libs/ardour/route.cc132
13 files changed, 137 insertions, 167 deletions
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 201e89db3b..de4af60136 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -1305,18 +1305,33 @@ ProcessorBox::paste_processor_state (const XMLNodeList& nlist, boost::shared_ptr
XMLNode n (**niter);
Send::make_unique (n, *_session);
- p.reset (new Send (*_session, _route->mute_master(), n));
+ Send* s = new Send (*_session, _route->mute_master());
+ if (s->set_state (n, Stateful::loading_state_version)) {
+ delete s;
+ return;
+ }
+
+ p.reset (s);
+
} else if (type->value() == "return") {
XMLNode n (**niter);
Return::make_unique (n, *_session);
- p.reset (new Return (*_session, **niter));
+ Return* r = new Return (*_session);
+
+ if (r->set_state (n, Stateful::loading_state_version)) {
+ delete r;
+ return;
+ }
+
+ p.reset (r);
} else {
/* XXX its a bit limiting to assume that everything else
is a plugin.
*/
+
p.reset (new PluginInsert (*_session, **niter));
}
diff --git a/libs/ardour/ardour/delivery.h b/libs/ardour/ardour/delivery.h
index b2bd283ef8..95ef485527 100644
--- a/libs/ardour/ardour/delivery.h
+++ b/libs/ardour/ardour/delivery.h
@@ -53,12 +53,10 @@ public:
/* Delivery to an existing output */
Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
- Delivery (Session& s, boost::shared_ptr<IO> io, boost::shared_ptr<MuteMaster> mm, const XMLNode&);
/* Delivery to a new output owned by this object */
Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const std::string& name, Role);
- Delivery (Session&, boost::shared_ptr<MuteMaster> mm, const XMLNode&);
~Delivery ();
bool set_name (const std::string& name);
diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h
index c5facebef6..25aba5415d 100644
--- a/libs/ardour/ardour/internal_return.h
+++ b/libs/ardour/ardour/internal_return.h
@@ -31,7 +31,6 @@ class InternalReturn : public Return
{
public:
InternalReturn (Session&);
- InternalReturn (Session&, const XMLNode&);
bool visible() const;
diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h
index ad498b852d..eabe263013 100644
--- a/libs/ardour/ardour/internal_send.h
+++ b/libs/ardour/ardour/internal_send.h
@@ -29,7 +29,6 @@ class InternalSend : public Send
{
public:
InternalSend (Session&, boost::shared_ptr<MuteMaster>, boost::shared_ptr<Route> send_to, Delivery::Role role);
- InternalSend (Session&, boost::shared_ptr<MuteMaster>, const XMLNode&);
virtual ~InternalSend ();
std::string display_name() const;
@@ -55,11 +54,13 @@ class InternalSend : public Send
boost::shared_ptr<Route> _send_to;
PBD::ID _send_to_id;
PBD::ScopedConnection connect_c;
+ PBD::ScopedConnectionList target_connections;
void send_to_going_away ();
void send_to_property_changed (const PBD::PropertyChange&);
int connect_when_legal ();
int set_our_state (XMLNode const &, int);
+ int use_target (boost::shared_ptr<Route>);
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/meter.h b/libs/ardour/ardour/meter.h
index 478a88efcf..80adcd4156 100644
--- a/libs/ardour/ardour/meter.h
+++ b/libs/ardour/ardour/meter.h
@@ -46,7 +46,6 @@ class Metering {
class PeakMeter : public Processor {
public:
PeakMeter(Session& s) : Processor(s, "Meter") {}
- PeakMeter(Session&s, const XMLNode& node);
void meter();
void reset ();
diff --git a/libs/ardour/ardour/monitor_processor.h b/libs/ardour/ardour/monitor_processor.h
index 2bef0286c8..18c50e5104 100644
--- a/libs/ardour/ardour/monitor_processor.h
+++ b/libs/ardour/ardour/monitor_processor.h
@@ -37,7 +37,6 @@ class MonitorProcessor : public Processor
{
public:
MonitorProcessor (Session&);
- MonitorProcessor (Session&, const XMLNode& name);
bool display_to_user() const;
diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc
index 7d6a4d9d79..eaf58c0a9b 100644
--- a/libs/ardour/delivery.cc
+++ b/libs/ardour/delivery.cc
@@ -94,61 +94,6 @@ Delivery::Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const string&
CycleStart.connect_same_thread (*this, boost::bind (&Delivery::cycle_start, this, _1));
}
-/* deliver to a new IO object, reconstruct from XML */
-
-Delivery::Delivery (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
- : IOProcessor (s, false, true, "reset")
- , _role (Role (0))
- , _output_buffers (new BufferSet())
- , _current_gain (1.0)
- , _output_offset (0)
- , _no_outs_cuz_we_no_monitor (false)
- , _solo_level (0)
- , _solo_isolated (false)
- , _mute_master (mm)
- , no_panner_reset (false)
-{
- _panner = boost::shared_ptr<Panner>(new Panner (_name, _session));
- _display_to_user = false;
-
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor ();
- }
-
- if (_output) {
- _output->changed.connect_same_thread (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
- }
-
- CycleStart.connect_same_thread (*this, boost::bind (&Delivery::cycle_start, this, _1));
-}
-
-/* deliver to an existing IO object, reconstruct from XML */
-
-Delivery::Delivery (Session& s, boost::shared_ptr<IO> out, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
- : IOProcessor (s, boost::shared_ptr<IO>(), out, "reset")
- , _role (Role (0))
- , _output_buffers (new BufferSet())
- , _current_gain (1.0)
- , _output_offset (0)
- , _no_outs_cuz_we_no_monitor (false)
- , _solo_level (0)
- , _solo_isolated (false)
- , _mute_master (mm)
- , no_panner_reset (false)
-{
- _panner = boost::shared_ptr<Panner>(new Panner (_name, _session));
- _display_to_user = false;
-
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor ();
- }
-
- if (_output) {
- _output->changed.connect_same_thread (*this, boost::bind (&Delivery::output_changed, this, _1, _2));
- }
-
- CycleStart.connect_same_thread (*this, boost::bind (&Delivery::cycle_start, this, _1));
-}
Delivery::~Delivery()
{
diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc
index 279472e02d..280568131f 100644
--- a/libs/ardour/internal_return.cc
+++ b/libs/ardour/internal_return.cc
@@ -36,13 +36,6 @@ InternalReturn::InternalReturn (Session& s)
CycleStart.connect_same_thread (*this, boost::bind (&InternalReturn::cycle_start, this, _1));
}
-InternalReturn::InternalReturn (Session& s, const XMLNode& node)
- : Return (s, node, true)
- , user_count (0)
-{
- CycleStart.connect_same_thread (*this, boost::bind (&InternalReturn::cycle_start, this, _1));
-}
-
void
InternalReturn::run (BufferSet& bufs, sframes_t /*start_frame*/, sframes_t /*end_frame*/, nframes_t nframes, bool)
{
diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc
index 9cfc8d9702..3662171740 100644
--- a/libs/ardour/internal_send.cc
+++ b/libs/ardour/internal_send.cc
@@ -34,24 +34,12 @@ using namespace std;
InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost::shared_ptr<Route> sendto, Delivery::Role role)
: Send (s, mm, role)
- , _send_to (sendto)
{
- if ((target = _send_to->get_return_buffer ()) == 0) {
- throw failed_constructor();
- }
-
- set_name (sendto->name());
-
- _send_to->DropReferences.connect_same_thread (*this, boost::bind (&InternalSend::send_to_going_away, this));
- _send_to->PropertyChanged.connect_same_thread (*this, boost::bind (&InternalSend::send_to_property_changed, this, _1));;
-}
-
-InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
- : Send (s, mm, node, Stateful::loading_state_version, Delivery::Aux /* will be reset in set_state() */),
- target (0)
-{
- /* Send constructor will set its state, so here we just need to set up our own */
- set_our_state (node, Stateful::loading_state_version);
+ if (sendto) {
+ if (use_target (sendto)) {
+ throw failed_constructor();
+ }
+ }
}
InternalSend::~InternalSend ()
@@ -59,14 +47,34 @@ InternalSend::~InternalSend ()
if (_send_to) {
_send_to->release_return_buffer ();
}
+}
- connect_c.disconnect ();
+int
+InternalSend::use_target (boost::shared_ptr<Route> sendto)
+{
+ _send_to = sendto;
+
+ if ((target = _send_to->get_return_buffer ()) == 0) {
+ return -1;
+ }
+
+ set_name (sendto->name());
+ _send_to_id = _send_to->id();
+
+ target_connections.drop_connections ();
+
+ _send_to->DropReferences.connect_same_thread (target_connections, boost::bind (&InternalSend::send_to_going_away, this));
+ _send_to->PropertyChanged.connect_same_thread (target_connections, boost::bind (&InternalSend::send_to_property_changed, this, _1));;
+
+ return 0;
}
+
void
InternalSend::send_to_going_away ()
{
target = 0;
+ target_connections.drop_connections ();
_send_to.reset ();
_send_to_id = "0";
}
@@ -212,17 +220,14 @@ InternalSend::connect_when_legal ()
return 0;
}
- if ((_send_to = _session.route_by_id (_send_to_id)) == 0) {
- error << X_("cannot find route to connect to") << endmsg;
- return -1;
- }
+ boost::shared_ptr<Route> sendto;
- if ((target = _send_to->get_return_buffer ()) == 0) {
- error << X_("target for internal send has no return buffer") << endmsg;
+ if ((sendto = _session.route_by_id (_send_to_id)) == 0) {
+ error << X_("cannot find route to connect to") << endmsg;
return -1;
}
- return 0;
+ return use_target (sendto);
}
bool
diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc
index e49b69574e..0104de4bbd 100644
--- a/libs/ardour/meter.cc
+++ b/libs/ardour/meter.cc
@@ -33,12 +33,6 @@ using namespace ARDOUR;
PBD::Signal0<void> Metering::Meter;
-PeakMeter::PeakMeter (Session& s, const XMLNode& node)
- : Processor (s, node)
-{
-
-}
-
/** Get peaks from @a bufs
* Input acceptance is lenient - the first n buffers from @a bufs will
* be metered, where n was set by the last call to setup(), excess meters will
diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc
index 8399c0382a..51bd30a389 100644
--- a/libs/ardour/monitor_processor.cc
+++ b/libs/ardour/monitor_processor.cc
@@ -25,12 +25,6 @@ MonitorProcessor::MonitorProcessor (Session& s)
_solo_boost_level = 1.0;
}
-MonitorProcessor::MonitorProcessor (Session& s, const XMLNode& node)
- : Processor (s, node)
-{
- set_state (node, Stateful::loading_state_version);
-}
-
void
MonitorProcessor::allocate_channels (uint32_t size)
{
diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc
index c2c227769d..39acf0ddf1 100644
--- a/libs/ardour/return.cc
+++ b/libs/ardour/return.cc
@@ -49,22 +49,6 @@ Return::Return (Session& s, bool internal)
ProcessorCreated (this); /* EMIT SIGNAL */
}
-Return::Return (Session& s, const XMLNode& node, bool internal)
- : IOProcessor (s, (internal ? false : true), false, "return")
- , _metering (false)
-{
- /* never muted */
-
- _amp.reset (new Amp (_session, boost::shared_ptr<MuteMaster>()));
- _meter.reset (new PeakMeter (_session));
-
- if (set_state (node, Stateful::loading_state_version)) {
- throw failed_constructor();
- }
-
- ProcessorCreated (this); /* EMIT SIGNAL */
-}
-
Return::~Return ()
{
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 2199c71caa..f0c52daa6f 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -456,8 +456,6 @@ Route::process_output_buffers (BufferSet& bufs,
}
assert (bufs.count() == (*i)->input_streams());
- cerr << _name << " run processor " << (*i)->name() << " with " << bufs.count() << endl;
-
(*i)->run (bufs, start_frame, end_frame, nframes, *i != _processors.back());
bufs.set_count ((*i)->output_streams());
}
@@ -808,6 +806,20 @@ Route::add_processor (boost::shared_ptr<Processor> processor, ProcessorList::ite
}
+ /* is this the monitor send ? if so, make sure we keep track of it */
+
+ boost::shared_ptr<InternalSend> isend = boost::dynamic_pointer_cast<InternalSend> (processor);
+
+ if (isend && _session.monitor_out() && (isend->target_id() == _session.monitor_out()->id())) {
+ _monitor_send = isend;
+
+ if (_monitor_send->active()) {
+ _monitor_send->set_solo_level (1);
+ } else {
+ _monitor_send->set_solo_level (0);
+ }
+ }
+
if (activation_allowed && (processor != _monitor_send)) {
processor->activate ();
}
@@ -836,22 +848,9 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
boost::shared_ptr<Processor> processor;
- if (prop->value() == "ladspa" || prop->value() == "Ladspa" ||
- prop->value() == "lv2" ||
- prop->value() == "vst" ||
- prop->value() == "audiounit") {
-
- processor.reset (new PluginInsert(_session, node));
-
- } else if (prop->value() == "port") {
-
- processor.reset (new PortInsert (_session, _mute_master, node));
-
- } else if (prop->value() == "send") {
-
- processor.reset (new Send (_session, _mute_master, node));
-
- } else if (prop->value() == "meter") {
+ /* meter, amp, monitor and intreturn are all singletons, deal with them first */
+
+ if (prop->value() == "meter") {
if (_meter) {
if (_meter->set_state (node, Stateful::loading_state_version)) {
@@ -861,8 +860,16 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
}
}
- _meter.reset (new PeakMeter (_session, node));
+ PeakMeter* pm = new PeakMeter (_session);
+
+ if (pm->set_state (node, Stateful::loading_state_version)) {
+ delete pm;
+ return false;
+ }
+
+ _meter.reset (pm);
_meter->set_display_to_user (_meter_point == MeterCustom);
+
processor = _meter;
} else if (prop->value() == "monitor") {
@@ -874,37 +881,36 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
return true;
}
}
-
- _monitor_control.reset (new MonitorProcessor (_session));
- _monitor_control->set_state (node, Stateful::loading_state_version);
- processor = _monitor_control;
-
- } else if (prop->value() == "amp") {
- /* amp always exists */
+ MonitorProcessor* mp = new MonitorProcessor (_session);
+ if (mp->set_state (node, Stateful::loading_state_version)) {
+ delete mp;
+ return false;
+ }
- processor = _amp;
- if (processor->set_state (node, Stateful::loading_state_version)) {
- return false;
- } else {
- /* never any reason to add it */
- return true;
- }
+ _monitor_control.reset (mp);
+ processor = _monitor_control;
- } else if (prop->value() == "intsend") {
+ } else if (prop->value() == "amp") {
- InternalSend* isend = new InternalSend (_session, _mute_master, node);
-
- if (_session.monitor_out() && (isend->target_id() == _session.monitor_out()->id())) {
- _monitor_send.reset (isend);
- if (_monitor_send->active()) {
- _monitor_send->set_solo_level (1);
+ if (_amp) {
+ processor = _amp;
+ if (processor->set_state (node, Stateful::loading_state_version)) {
+ return false;
} else {
- _monitor_send->set_solo_level (0);
+ /* no reason to add it */
+ return true;
}
}
- processor.reset (isend);
+ Amp* a = new Amp (_session, _mute_master);
+ if (_amp->set_state (node, Stateful::loading_state_version)) {
+ delete a;
+ return false;
+ }
+
+ _amp.reset (a);
+ processor = _amp;
} else if (prop->value() == "intreturn") {
@@ -919,7 +925,14 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
return true;
}
}
- _intreturn.reset (new InternalReturn (_session, node));
+
+ InternalReturn* iret = new InternalReturn (_session);
+ if (iret->set_state (node, Stateful::loading_state_version)) {
+ delete iret;
+ return false;
+ }
+
+ _intreturn.reset (iret);
processor = _intreturn;
} else if (prop->value() == "main-outs") {
@@ -932,9 +945,40 @@ Route::add_processor_from_xml (const XMLNode& node, ProcessorList::iterator iter
}
}
- _main_outs.reset (new Delivery (_session, _output, _mute_master, node));
+ Delivery* del = new Delivery (_session, _output, _mute_master, X_("toBeResetFroXML"), Delivery::Role (0));
+ if (del->set_state (node, Stateful::loading_state_version)) {
+ delete del;
+ return false;
+ }
+
+ _main_outs.reset (del);
processor = _main_outs;
+ } else if (prop->value() == "intsend") {
+
+ InternalSend* isend = new InternalSend (_session, _mute_master, boost::shared_ptr<Route>(), Delivery::Role (0));
+ if (isend->set_state (node, Stateful::loading_state_version)) {
+ delete isend;
+ return false;
+ }
+
+ processor.reset (isend);
+
+ } else if (prop->value() == "ladspa" || prop->value() == "Ladspa" ||
+ prop->value() == "lv2" ||
+ prop->value() == "vst" ||
+ prop->value() == "audiounit") {
+
+ processor.reset (new PluginInsert(_session, node));
+
+ } else if (prop->value() == "port") {
+
+ processor.reset (new PortInsert (_session, _mute_master, node));
+
+ } else if (prop->value() == "send") {
+
+ processor.reset (new Send (_session, _mute_master, node));
+
} else {
error << string_compose(_("unknown Processor type \"%1\"; ignored"), prop->value()) << endmsg;
return false;