summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-01-27 18:36:40 +0000
committerCarl Hetherington <carl@carlh.net>2009-01-27 18:36:40 +0000
commit948034f15aa8716fc87cc0efefe6152d27de5552 (patch)
tree9d4cd49f8da82942367d73ba5fa2465c7c3d7599 /libs
parentb2e163a410a62a20e982b3baac0cf65e611acbce (diff)
Make track sends etc. appear in the same bundle as the track. Tidy up bundle channel naming a bit.
git-svn-id: svn://localhost/ardour2/branches/3.0@4448 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/bundle.h4
-rw-r--r--libs/ardour/ardour/io.h1
-rw-r--r--libs/ardour/bundle.cc32
-rw-r--r--libs/ardour/io.cc24
4 files changed, 57 insertions, 4 deletions
diff --git a/libs/ardour/ardour/bundle.h b/libs/ardour/ardour/bundle.h
index f9971ddf15..ac5928fc34 100644
--- a/libs/ardour/ardour/bundle.h
+++ b/libs/ardour/ardour/bundle.h
@@ -24,6 +24,7 @@
#include <vector>
#include <glibmm/thread.h>
#include <sigc++/signal.h>
+#include <boost/shared_ptr.hpp>
#include "ardour/data_type.h"
namespace ARDOUR {
@@ -72,6 +73,8 @@ class Bundle : public sigc::trackable
*/
Bundle (std::string const & n, DataType t, bool i = true) : _name (n), _type (t), _ports_are_inputs (i) {}
+ Bundle (boost::shared_ptr<Bundle>);
+
virtual ~Bundle() {}
/** @return Number of channels that this Bundle has */
@@ -93,6 +96,7 @@ class Bundle : public sigc::trackable
bool offers_port_alone (std::string) const;
void remove_channel (uint32_t);
void remove_channels ();
+ void add_channels_from_bundle (boost::shared_ptr<ARDOUR::Bundle>);
/** Set the name.
* @param n New name.
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 1918a9a41a..2d5b55c502 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -380,6 +380,7 @@ class IO : public SessionObject, public AutomatableControls, public Latent
void create_bundles_for_inputs_and_outputs ();
void setup_bundles_for_inputs_and_outputs ();
+ std::string bundle_channel_name (uint32_t, uint32_t) const;
};
} // namespace ARDOUR
diff --git a/libs/ardour/bundle.cc b/libs/ardour/bundle.cc
index 53fc2f1930..48c0ead6e6 100644
--- a/libs/ardour/bundle.cc
+++ b/libs/ardour/bundle.cc
@@ -29,6 +29,15 @@
using namespace ARDOUR;
using namespace PBD;
+Bundle::Bundle (boost::shared_ptr<Bundle> other)
+ : _channel (other->_channel),
+ _name (other->_name),
+ _type (other->_type),
+ _ports_are_inputs (other->_ports_are_inputs)
+{
+
+}
+
uint32_t
Bundle::nchannels () const
{
@@ -211,3 +220,26 @@ Bundle::set_channel_name (uint32_t ch, std::string const & n)
NameChanged (); /* EMIT SIGNAL */
}
+
+/** Take the channels from another bundle and add them to this bundle,
+ * so that channels from other are added to this (with their ports)
+ * and are named "<other_bundle_name> <other_channel_name>".
+ */
+void
+Bundle::add_channels_from_bundle (boost::shared_ptr<Bundle> other)
+{
+ uint32_t const ch = nchannels ();
+
+ for (uint32_t i = 0; i < other->nchannels(); ++i) {
+
+ std::stringstream s;
+ s << other->name() << " " << other->channel_name(i);
+
+ add_channel (s.str());
+
+ PortList const& pl = other->channel_ports (i);
+ for (uint32_t j = 0; j < pl.size(); ++j) {
+ add_port_to_channel (ch + i, pl[j]);
+ }
+ }
+}
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index b86462472a..a5a330cc36 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -2601,8 +2601,7 @@ IO::setup_bundles_for_inputs_and_outputs ()
_bundle_for_inputs->set_name (buf);
uint32_t const ni = inputs().num_ports();
for (uint32_t i = 0; i < ni; ++i) {
- snprintf (buf, sizeof(buf), _("in %d"), (i + 1));
- _bundle_for_inputs->add_channel (buf);
+ _bundle_for_inputs->add_channel (bundle_channel_name (i, ni));
_bundle_for_inputs->set_port (i, _session.engine().make_port_name_non_relative (inputs().port(i)->name()));
}
@@ -2610,8 +2609,7 @@ IO::setup_bundles_for_inputs_and_outputs ()
_bundle_for_outputs->set_name (buf);
uint32_t const no = outputs().num_ports();
for (uint32_t i = 0; i < no; ++i) {
- snprintf (buf, sizeof(buf), _("out %d"), (i + 1));
- _bundle_for_outputs->add_channel (buf);
+ _bundle_for_outputs->add_channel (bundle_channel_name (i, no));
_bundle_for_outputs->set_port (i, _session.engine().make_port_name_non_relative (outputs().port(i)->name()));
}
}
@@ -2725,3 +2723,21 @@ IO::flush_outputs (nframes_t nframes, nframes_t offset)
}
}
+
+std::string
+IO::bundle_channel_name (uint32_t c, uint32_t n) const
+{
+ char buf[32];
+
+ switch (n) {
+ case 1:
+ return _("mono");
+ case 2:
+ return c == 0 ? _("L") : _("R");
+ default:
+ snprintf (buf, sizeof(buf), _("%d"), (c + 1));
+ return buf;
+ }
+
+ return "";
+}