Re-enable creation of stereo bundles for system IO, so that the mixer strip
connection menus for stereo tracks are populated again. Also enable disconnection via these menus. git-svn-id: svn://localhost/ardour2/branches/3.0@4481 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
633629b2b1
commit
54afc94e62
@ -720,34 +720,34 @@ MixerStrip::input_press (GdkEventButton *ev)
|
||||
}
|
||||
|
||||
void
|
||||
MixerStrip::bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
|
||||
MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
|
||||
{
|
||||
if (!ignore_toggle) {
|
||||
if (ignore_toggle) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
_route->connect_input_ports_to_bundle (c, this);
|
||||
}
|
||||
ARDOUR::BundleList current = _route->bundles_connected_to_inputs ();
|
||||
|
||||
catch (AudioEngine::PortRegistrationFailure& err) {
|
||||
error << _("could not register new ports required for that bundle")
|
||||
<< endmsg;
|
||||
}
|
||||
if (std::find (current.begin(), current.end(), c) == current.end()) {
|
||||
_route->connect_input_ports_to_bundle (c, this);
|
||||
} else {
|
||||
_route->disconnect_input_ports_from_bundle (c, this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
|
||||
MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
|
||||
{
|
||||
if (!ignore_toggle) {
|
||||
if (ignore_toggle) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
_route->connect_output_ports_to_bundle (c, this);
|
||||
}
|
||||
ARDOUR::BundleList current = _route->bundles_connected_to_outputs ();
|
||||
|
||||
catch (AudioEngine::PortRegistrationFailure& err) {
|
||||
error << _("could not register new ports required for that bundle")
|
||||
<< endmsg;
|
||||
}
|
||||
if (std::find (current.begin(), current.end(), c) == current.end()) {
|
||||
_route->connect_output_ports_to_bundle (c, this);
|
||||
} else {
|
||||
_route->disconnect_output_ports_from_bundle (c, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ MixerStrip::add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR::Bundl
|
||||
|
||||
if (b->nchannels() == _route->n_inputs().get (b->type ())) {
|
||||
|
||||
citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
|
||||
citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_input_toggled), b)));
|
||||
|
||||
if (std::find (current.begin(), current.end(), b) != current.end()) {
|
||||
ignore_toggle = true;
|
||||
@ -790,7 +790,7 @@ MixerStrip::add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::Bund
|
||||
if (b->nchannels() == _route->n_outputs().get (b->type ())) {
|
||||
|
||||
MenuList& citems = output_menu.items();
|
||||
citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
|
||||
citems.push_back (CheckMenuElem (b->name(), bind (mem_fun(*this, &MixerStrip::bundle_output_toggled), b)));
|
||||
|
||||
if (std::find (current.begin(), current.end(), b) != current.end()) {
|
||||
ignore_toggle = true;
|
||||
|
@ -183,8 +183,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
|
||||
Gtk::Menu output_menu;
|
||||
void add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
|
||||
|
||||
void bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
||||
void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
||||
void bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle>);
|
||||
void bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle>);
|
||||
|
||||
void edit_input_configuration ();
|
||||
void edit_output_configuration ();
|
||||
|
@ -192,11 +192,12 @@ PortGroupList::gather (ARDOUR::Session& session, bool inputs)
|
||||
}
|
||||
}
|
||||
|
||||
/* Bundles created by the session */
|
||||
/* Bundles created by the session. We only add the mono ones,
|
||||
otherwise there is duplication of the same ports within the matrix */
|
||||
|
||||
boost::shared_ptr<ARDOUR::BundleList> b = session.bundles ();
|
||||
for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {
|
||||
if ((*i)->ports_are_inputs() == inputs && (*i)->type() == _type) {
|
||||
if ((*i)->nchannels() == 1 && (*i)->ports_are_inputs() == inputs && (*i)->type() == _type) {
|
||||
system->add_bundle (*i);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "ardour/data_type.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
class AudioEngine;
|
||||
|
||||
/** A set of `channels', each of which is associated with 0 or more ports.
|
||||
* Each channel has a name which can be anything useful.
|
||||
@ -96,7 +98,9 @@ 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>);
|
||||
void add_channels_from_bundle (boost::shared_ptr<Bundle>);
|
||||
void connect (boost::shared_ptr<Bundle>, AudioEngine &);
|
||||
void disconnect (boost::shared_ptr<Bundle>, AudioEngine &);
|
||||
|
||||
/** Set the name.
|
||||
* @param n New name.
|
||||
@ -143,7 +147,7 @@ class Bundle : public sigc::trackable
|
||||
int parse_io_string (std::string const &, std::vector<std::string> &);
|
||||
|
||||
std::string _name;
|
||||
ARDOUR::DataType _type;
|
||||
DataType _type;
|
||||
bool _ports_are_inputs;
|
||||
};
|
||||
|
||||
@ -153,7 +157,7 @@ struct BundleChannel
|
||||
{
|
||||
BundleChannel () : channel (0) {}
|
||||
|
||||
BundleChannel (boost::shared_ptr<ARDOUR::Bundle> b, uint32_t c)
|
||||
BundleChannel (boost::shared_ptr<Bundle> b, uint32_t c)
|
||||
: bundle (b), channel (c) {}
|
||||
|
||||
bool operator== (BundleChannel const& other) const {
|
||||
@ -164,13 +168,10 @@ struct BundleChannel
|
||||
return bundle != other.bundle || channel != other.channel;
|
||||
}
|
||||
|
||||
boost::shared_ptr<ARDOUR::Bundle> bundle;
|
||||
boost::shared_ptr<Bundle> bundle;
|
||||
uint32_t channel;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* __ardour_bundle_h__ */
|
||||
|
@ -128,8 +128,10 @@ class IO : public SessionObject, public AutomatableControls, public Latent
|
||||
|
||||
int ensure_io (ChanCount in, ChanCount out, bool clear, void *src);
|
||||
|
||||
int connect_input_ports_to_bundle (boost::shared_ptr<Bundle>, void *src);
|
||||
int connect_output_ports_to_bundle (boost::shared_ptr<Bundle>, void *src);
|
||||
int connect_input_ports_to_bundle (boost::shared_ptr<Bundle>, void *);
|
||||
int disconnect_input_ports_from_bundle (boost::shared_ptr<Bundle>, void *);
|
||||
int connect_output_ports_to_bundle (boost::shared_ptr<Bundle>, void *);
|
||||
int disconnect_output_ports_from_bundle (boost::shared_ptr<Bundle>, void *);
|
||||
|
||||
BundleList bundles_connected_to_inputs ();
|
||||
BundleList bundles_connected_to_outputs ();
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <pbd/failed_constructor.h>
|
||||
#include <ardour/ardour.h>
|
||||
#include <ardour/bundle.h>
|
||||
#include <ardour/audioengine.h>
|
||||
#include <pbd/xml++.h>
|
||||
|
||||
#include "i18n.h"
|
||||
@ -243,3 +244,39 @@ Bundle::add_channels_from_bundle (boost::shared_ptr<Bundle> other)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Bundle::connect (boost::shared_ptr<Bundle> other, AudioEngine & engine)
|
||||
{
|
||||
uint32_t const N = nchannels ();
|
||||
assert (N == other->nchannels ());
|
||||
|
||||
for (uint32_t i = 0; i < N; ++i) {
|
||||
Bundle::PortList const & our_ports = channel_ports (i);
|
||||
Bundle::PortList const & other_ports = other->channel_ports (i);
|
||||
|
||||
for (Bundle::PortList::const_iterator j = our_ports.begin(); j != our_ports.end(); ++j) {
|
||||
for (Bundle::PortList::const_iterator k = other_ports.begin(); k != other_ports.end(); ++k) {
|
||||
engine.connect (*j, *k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Bundle::disconnect (boost::shared_ptr<Bundle> other, AudioEngine & engine)
|
||||
{
|
||||
uint32_t const N = nchannels ();
|
||||
assert (N == other->nchannels ());
|
||||
|
||||
for (uint32_t i = 0; i < N; ++i) {
|
||||
Bundle::PortList const & our_ports = channel_ports (i);
|
||||
Bundle::PortList const & other_ports = other->channel_ports (i);
|
||||
|
||||
for (Bundle::PortList::const_iterator j = our_ports.begin(); j != our_ports.end(); ++j) {
|
||||
for (Bundle::PortList::const_iterator k = other_ports.begin(); k != other_ports.end(); ++k) {
|
||||
engine.disconnect (*j, *k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2062,25 +2062,7 @@ IO::connect_input_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
|
||||
BLOCK_PROCESS_CALLBACK ();
|
||||
Glib::Mutex::Lock lm2 (io_lock);
|
||||
|
||||
/* Connect to the bundle, not worrying about any connections
|
||||
that are already made. */
|
||||
|
||||
uint32_t cnt = c->nchannels ();
|
||||
|
||||
for (uint32_t n = 0; n < cnt; ++n) {
|
||||
const Bundle::PortList& pl = c->channel_ports (n);
|
||||
|
||||
for (Bundle::PortList::const_iterator i = pl.begin(); i != pl.end(); ++i) {
|
||||
|
||||
if (!_inputs.port(n)->connected_to (*i)) {
|
||||
|
||||
if (_session.engine().connect (*i, _inputs.port(n)->name())) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
c->connect (_bundle_for_inputs, _session.engine());
|
||||
|
||||
/* If this is a UserBundle, make a note of what we've done */
|
||||
|
||||
@ -2104,6 +2086,35 @@ IO::connect_input_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
IO::disconnect_input_ports_from_bundle (boost::shared_ptr<Bundle> c, void* src)
|
||||
{
|
||||
{
|
||||
BLOCK_PROCESS_CALLBACK ();
|
||||
Glib::Mutex::Lock lm2 (io_lock);
|
||||
|
||||
c->disconnect (_bundle_for_inputs, _session.engine());
|
||||
|
||||
/* If this is a UserBundle, make a note of what we've done */
|
||||
|
||||
boost::shared_ptr<UserBundle> ub = boost::dynamic_pointer_cast<UserBundle> (c);
|
||||
if (ub) {
|
||||
|
||||
std::vector<UserBundleInfo>::iterator i = _bundles_connected_to_inputs.begin();
|
||||
while (i != _bundles_connected_to_inputs.end() && i->bundle != ub) {
|
||||
++i;
|
||||
}
|
||||
|
||||
if (i != _bundles_connected_to_inputs.end()) {
|
||||
_bundles_connected_to_inputs.erase (i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
input_changed (IOChange (ConfigurationChanged|ConnectionsChanged), src); /* EMIT SIGNAL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
IO::connect_output_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
|
||||
{
|
||||
@ -2111,25 +2122,7 @@ IO::connect_output_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
|
||||
BLOCK_PROCESS_CALLBACK ();
|
||||
Glib::Mutex::Lock lm2 (io_lock);
|
||||
|
||||
/* Connect to the bundle, not worrying about any connections
|
||||
that are already made. */
|
||||
|
||||
uint32_t cnt = c->nchannels ();
|
||||
|
||||
for (uint32_t n = 0; n < cnt; ++n) {
|
||||
|
||||
const Bundle::PortList& pl = c->channel_ports (n);
|
||||
|
||||
for (Bundle::PortList::const_iterator i = pl.begin(); i != pl.end(); ++i) {
|
||||
|
||||
if (!_outputs.port(n)->connected_to (*i)) {
|
||||
|
||||
if (_session.engine().connect (_outputs.port(n)->name(), *i)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
c->connect (_bundle_for_outputs, _session.engine());
|
||||
|
||||
/* If this is a UserBundle, make a note of what we've done */
|
||||
|
||||
@ -2154,6 +2147,36 @@ IO::connect_output_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
IO::disconnect_output_ports_from_bundle (boost::shared_ptr<Bundle> c, void* src)
|
||||
{
|
||||
{
|
||||
BLOCK_PROCESS_CALLBACK ();
|
||||
Glib::Mutex::Lock lm2 (io_lock);
|
||||
|
||||
c->disconnect (_bundle_for_outputs, _session.engine());
|
||||
|
||||
/* If this is a UserBundle, make a note of what we've done */
|
||||
|
||||
boost::shared_ptr<UserBundle> ub = boost::dynamic_pointer_cast<UserBundle> (c);
|
||||
if (ub) {
|
||||
|
||||
std::vector<UserBundleInfo>::iterator i = _bundles_connected_to_outputs.begin();
|
||||
while (i != _bundles_connected_to_outputs.end() && i->bundle != ub) {
|
||||
++i;
|
||||
}
|
||||
|
||||
if (i != _bundles_connected_to_outputs.end()) {
|
||||
_bundles_connected_to_outputs.erase (i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output_changed (IOChange (ConfigurationChanged|ConnectionsChanged), src); /* EMIT SIGNAL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
IO::disable_connecting ()
|
||||
{
|
||||
|
@ -595,7 +595,11 @@ Session::when_engine_running ()
|
||||
BootMessage (_("Set up standard connections"));
|
||||
|
||||
/* Create a set of Bundle objects that map
|
||||
to the physical I/O currently available */
|
||||
to the physical I/O currently available. We create both
|
||||
mono and stereo bundles, so that the common cases of mono
|
||||
and stereo tracks get bundles to put in their mixer strip
|
||||
in / out menus. There may be a nicer way of achieving that;
|
||||
it doesn't really scale that well to higher channel counts */
|
||||
|
||||
for (uint32_t np = 0; np < n_physical_outputs; ++np) {
|
||||
char buf[32];
|
||||
@ -608,6 +612,20 @@ Session::when_engine_running ()
|
||||
add_bundle (c);
|
||||
}
|
||||
|
||||
for (uint32_t np = 0; np < n_physical_outputs; np += 2) {
|
||||
if (np + 1 < n_physical_outputs) {
|
||||
char buf[32];
|
||||
snprintf (buf, sizeof(buf), _("out %" PRIu32 "+%" PRIu32), np + 1, np + 2);
|
||||
shared_ptr<Bundle> c (new Bundle (buf, true));
|
||||
c->add_channel (_("L"));
|
||||
c->set_port (0, _engine.get_nth_physical_output (DataType::AUDIO, np));
|
||||
c->add_channel (_("R"));
|
||||
c->set_port (1, _engine.get_nth_physical_output (DataType::AUDIO, np + 1));
|
||||
|
||||
add_bundle (c);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t np = 0; np < n_physical_inputs; ++np) {
|
||||
char buf[32];
|
||||
snprintf (buf, sizeof (buf), _("in %" PRIu32), np+1);
|
||||
@ -619,6 +637,21 @@ Session::when_engine_running ()
|
||||
add_bundle (c);
|
||||
}
|
||||
|
||||
for (uint32_t np = 0; np < n_physical_inputs; np += 2) {
|
||||
if (np + 1 < n_physical_inputs) {
|
||||
char buf[32];
|
||||
snprintf (buf, sizeof(buf), _("in %" PRIu32 "+%" PRIu32), np + 1, np + 2);
|
||||
|
||||
shared_ptr<Bundle> c (new Bundle (buf, false));
|
||||
c->add_channel (_("L"));
|
||||
c->set_port (0, _engine.get_nth_physical_input (DataType::AUDIO, np));
|
||||
c->add_channel (_("R"));
|
||||
c->set_port (1, _engine.get_nth_physical_input (DataType::AUDIO, np + 1));
|
||||
|
||||
add_bundle (c);
|
||||
}
|
||||
}
|
||||
|
||||
if (_master_out) {
|
||||
|
||||
/* create master/control ports */
|
||||
|
Loading…
Reference in New Issue
Block a user