X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsend.cc;h=48083d594ab37db39523e3c5a55e98e8891d0afd;hb=ad547e53fc168410b22628a8cb125e8d4da4b293;hp=91e6827e6166435a2e0e040b46b9813fe9adb27b;hpb=926f53244df3d0f43f647f93ee091378ebe101d6;p=ardour.git diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 91e6827e61..48083d594a 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -42,29 +42,13 @@ Send::Send (Session& s, boost::shared_ptr mm, Role r) : Delivery (s, mm, string_compose (_("send %1"), (_bitslot = s.next_send_id()) + 1), r) , _metering (false) { - _amp.reset (new Amp (_session, _mute_master)); + _amp.reset (new Amp (_session)); _meter.reset (new PeakMeter (_session)); - - ProcessorCreated (this); /* EMIT SIGNAL */ -} - -Send::Send (Session& s, boost::shared_ptr mm, const XMLNode& node, int version, Role r) - : Delivery (s, mm, "send", r) - , _metering (false) -{ - _amp.reset (new Amp (_session, _mute_master)); - _meter.reset (new PeakMeter (_session)); - - if (set_state (node, version)) { - throw failed_constructor(); - } - - ProcessorCreated (this); /* EMIT SIGNAL */ } Send::~Send () { - GoingAway (); + _session.unmark_send_id (_bitslot); } void @@ -87,7 +71,7 @@ Send::deactivate () } void -Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes) +Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, nframes_t nframes, bool) { if (_output->n_ports() == ChanCount::ZERO) { _meter->reset (); @@ -114,11 +98,11 @@ Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_ // Can't automate gain for sends or returns yet because we need different buffers // so that we don't overwrite the main automation data for the route amp // _amp->setup_gain_automation (start_frame, end_frame, nframes); - _amp->run (sendbufs, start_frame, end_frame, nframes); + _amp->run (sendbufs, start_frame, end_frame, nframes, true); /* deliver to outputs */ - Delivery::run (sendbufs, start_frame, end_frame, nframes); + Delivery::run (sendbufs, start_frame, end_frame, nframes, true); /* consider metering */ @@ -126,7 +110,7 @@ Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_ if (_amp->gain_control()->get_value() == 0) { _meter->reset(); } else { - _meter->run (*_output_buffers, start_frame, end_frame, nframes); + _meter->run (*_output_buffers, start_frame, end_frame, nframes, true); } } @@ -140,7 +124,7 @@ Send::get_state(void) } XMLNode& -Send::state(bool full) +Send::state (bool full) { XMLNode& node = Delivery::state(full); char buf[32]; @@ -155,23 +139,64 @@ Send::state(bool full) int Send::set_state (const XMLNode& node, int version) { + if (version < 3000) { + return set_state_2X (node, version); + } + XMLNodeList nlist = node.children(); XMLNodeIterator niter; const XMLProperty* prop; - if ((prop = node.property ("bitslot")) == 0) { - _bitslot = _session.next_send_id(); - } else { - sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot); - cerr << this << " scanned " << prop->value() << " to get " << _bitslot << endl; - _session.mark_send_id (_bitslot); - } + Delivery::set_state (node, version); + + /* don't try to reset bitslot if its already set: this can cause + issues with the session's accounting of send ID's + */ - const XMLNode* insert_node = &node; + if ((prop = node.property ("bitslot")) == 0) { + _bitslot = _session.next_send_id(); + } else { + _session.unmark_send_id (_bitslot); + sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot); + _session.mark_send_id (_bitslot); + } /* XXX need to load automation state & data for amp */ - Delivery::set_state (*insert_node, version); + return 0; +} + +int +Send::set_state_2X (const XMLNode& node, int version) +{ + /* use the IO's name for the name of the send */ + XMLNodeList const & children = node.children (); + + XMLNodeList::const_iterator i = children.begin(); + while (i != children.end() && (*i)->name() != X_("Redirect")) { + ++i; + } + + if (i == children.end()) { + return -1; + } + + XMLNodeList const & grand_children = (*i)->children (); + XMLNodeList::const_iterator j = grand_children.begin (); + while (j != grand_children.end() && (*j)->name() != X_("IO")) { + ++j; + } + + if (j == grand_children.end()) { + return -1; + } + + XMLProperty const * prop = (*j)->property X_("name"); + if (!prop) { + return -1; + } + + set_name (prop->value ()); return 0; } @@ -194,6 +219,10 @@ Send::configure_io (ChanCount in, ChanCount out) return false; } + if (_output) { + _output->ensure_io (out, false, 0); + } + if (!Processor::configure_io (in, out)) { return false; } @@ -262,6 +291,7 @@ Send::display_to_user () const /* we ignore Deliver::_display_to_user */ if (_role == Listen) { + /* don't make the monitor/control/listen send visible */ return false; }