summaryrefslogtreecommitdiff
path: root/libs/ardour/send.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-03-13 20:14:55 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-03-13 20:14:55 +0000
commitd46acb86eaa3a94fb2dc673964271ecfe0f004dd (patch)
treee6e24673cff96baf335a2aa3583a8d8a8857d2a1 /libs/ardour/send.cc
parentb557061ec444cdac8b23d6e433a6fe26c1e176a1 (diff)
redesign how XML state, bitslots and names get propagated during copying a send/port insert/return
git-svn-id: svn://localhost/ardour2/branches/3.0@11669 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/send.cc')
-rw-r--r--libs/ardour/send.cc95
1 files changed, 53 insertions, 42 deletions
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index b6f042cbb2..ce48b2712b 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -85,6 +85,26 @@ 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);
@@ -191,34 +211,37 @@ Send::set_state (const XMLNode& node, int version)
Delivery::set_state (node, version);
- /* don't try to reset bitslot if there is a node for it already: this can cause
- issues with the session's accounting of send ID's
- */
+ if (node.property ("ignore-bitslot") == 0) {
- if ((prop = node.property ("bitslot")) == 0) {
- if (_role == Delivery::Aux) {
- _bitslot = _session.next_aux_send_id ();
- } else if (_role == Delivery::Send) {
- _bitslot = _session.next_send_id ();
- } else {
- // bitslot doesn't matter but make it zero anyway
- _bitslot = 0;
- }
- } else {
- if (_role == Delivery::Aux) {
- _session.unmark_aux_send_id (_bitslot);
- sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot);
- _session.mark_aux_send_id (_bitslot);
- } else if (_role == Delivery::Send) {
- _session.unmark_send_id (_bitslot);
- sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot);
- _session.mark_send_id (_bitslot);
+ /* don't try to reset bitslot if there is a node for it already: this can cause
+ issues with the session's accounting of send ID's
+ */
+
+ if ((prop = node.property ("bitslot")) == 0) {
+ if (_role == Delivery::Aux) {
+ _bitslot = _session.next_aux_send_id ();
+ } else if (_role == Delivery::Send) {
+ _bitslot = _session.next_send_id ();
+ } else {
+ // bitslot doesn't matter but make it zero anyway
+ _bitslot = 0;
+ }
} else {
- // bitslot doesn't matter but make it zero anyway
- _bitslot = 0;
+ if (_role == Delivery::Aux) {
+ _session.unmark_aux_send_id (_bitslot);
+ sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot);
+ _session.mark_aux_send_id (_bitslot);
+ } else if (_role == Delivery::Send) {
+ _session.unmark_send_id (_bitslot);
+ sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot);
+ _session.mark_send_id (_bitslot);
+ } else {
+ // bitslot doesn't matter but make it zero anyway
+ _bitslot = 0;
+ }
}
- }
-
+ }
+
XMLNodeList nlist = node.children();
for (XMLNodeIterator i = nlist.begin(); i != nlist.end(); ++i) {
if ((*i)->name() == X_("Processor")) {
@@ -292,28 +315,16 @@ Send::configure_io (ChanCount in, ChanCount out)
return true;
}
-/** Set up the XML description of a send so that its name is unique.
+/** 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, Session &session)
+Send::make_unique (XMLNode &state)
{
- uint32_t const bitslot = session.next_send_id() + 1;
-
- char buf[32];
- snprintf (buf, sizeof (buf), "%" PRIu32, bitslot);
- state.property("bitslot")->set_value (buf);
-
- string const name = string_compose (_("send %1"), bitslot);
-
- state.property("name")->set_value (name);
-
- XMLNode* io = state.child ("IO");
-
- if (io) {
- io->property("name")->set_value (name);
- }
+ state.add_property ("ignore-bitslot", "1");
+ state.add_property ("ignore-name", "1");
}
bool