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
This commit is contained in:
parent
b2e163a410
commit
948034f15a
@ -139,15 +139,40 @@ PortGroupList::gather (ARDOUR::Session& session)
|
||||
{
|
||||
clear_list ();
|
||||
|
||||
/* Find the bundles for routes */
|
||||
/* Find the bundles for routes. We take their bundles, copy them,
|
||||
and add ports from the route's processors */
|
||||
|
||||
boost::shared_ptr<ARDOUR::Session::RouteList> routes = session.get_routes ();
|
||||
|
||||
for (ARDOUR::Session::RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) {
|
||||
/* Copy the appropriate bundle from the route */
|
||||
boost::shared_ptr<ARDOUR::Bundle> bundle (
|
||||
new ARDOUR::Bundle (
|
||||
_offer_inputs ? (*i)->bundle_for_inputs() : (*i)->bundle_for_outputs ()
|
||||
)
|
||||
);
|
||||
|
||||
/* Route IO */
|
||||
/* Add ports from the route's processors */
|
||||
uint32_t n = 0;
|
||||
while (1) {
|
||||
boost::shared_ptr<ARDOUR::Processor> p = (*i)->nth_processor (n);
|
||||
if (p == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
boost::shared_ptr<ARDOUR::IOProcessor> iop = boost::dynamic_pointer_cast<ARDOUR::IOProcessor> (p);
|
||||
|
||||
if (iop) {
|
||||
boost::shared_ptr<ARDOUR::Bundle> pb = _offer_inputs ?
|
||||
iop->io()->bundle_for_inputs() : iop->io()->bundle_for_outputs();
|
||||
bundle->add_channels_from_bundle (pb);
|
||||
}
|
||||
|
||||
++n;
|
||||
}
|
||||
|
||||
/* Work out which group to put this bundle in */
|
||||
PortGroup* g = 0;
|
||||
|
||||
if (_type == ARDOUR::DataType::AUDIO) {
|
||||
|
||||
if (boost::dynamic_pointer_cast<ARDOUR::AudioTrack> (*i)) {
|
||||
@ -167,24 +192,7 @@ PortGroupList::gather (ARDOUR::Session& session)
|
||||
}
|
||||
|
||||
if (g) {
|
||||
g->add_bundle (_offer_inputs ? (*i)->bundle_for_inputs() : (*i)->bundle_for_outputs ());
|
||||
}
|
||||
|
||||
/* Ports from this route's processors */
|
||||
|
||||
uint32_t n = 0;
|
||||
while (1) {
|
||||
boost::shared_ptr<ARDOUR::Processor> p = (*i)->nth_processor (n);
|
||||
if (p == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
boost::shared_ptr<ARDOUR::IOProcessor> iop = boost::dynamic_pointer_cast<ARDOUR::IOProcessor> (p);
|
||||
if (iop) {
|
||||
g->add_bundle (_offer_inputs ? iop->io()->bundle_for_inputs() : iop->io()->bundle_for_outputs());
|
||||
}
|
||||
|
||||
++n;
|
||||
g->add_bundle (bundle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 "";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user