diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-24 14:01:31 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-24 14:01:31 +0000 |
commit | 2726184f42652a84816096887948658177ea24f8 (patch) | |
tree | a94ae006bedd134a762cd6ba2a1ab4d643b2f3be /libs/ardour/internal_send.cc | |
parent | b3a3e66f7755fe35ace4cbb6b19b54a52bb71a2f (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
Diffstat (limited to 'libs/ardour/internal_send.cc')
-rw-r--r-- | libs/ardour/internal_send.cc | 55 |
1 files changed, 30 insertions, 25 deletions
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 |