diff options
author | Robin Gareus <robin@gareus.org> | 2016-11-11 10:48:33 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-11-11 10:48:33 +0100 |
commit | 857c0d4a5e73d3b009533e934b464a7eb8e659d2 (patch) | |
tree | 4f8e62a5f46a19360ae43b903685527379dcbfc6 /gtk2_ardour | |
parent | dac2d41ee2bf658e9c7c841ce9459df43a4bd62b (diff) |
Refine instrument fan-out:
* prefix (rather than suffix) portgroup-name
* check if group already exists
* disconnect targets (when autoconnect preference is enabled)
* expose tracks/busses option
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/route_ui.cc | 27 |
2 files changed, 24 insertions, 6 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index fe31b8a3de..ca1b104e0f 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1698,7 +1698,8 @@ MixerStrip::build_route_ops_menu () if (_route->the_instrument () && _route->the_instrument ()->output_streams().n_audio() > 2) { // TODO ..->n_audio() > 1 && separate_output_groups) hard to check here every time. - items.push_back (MenuElem (_("Fan Out Instrument"), sigc::bind (sigc::mem_fun (*this, &RouteUI::fan_out), true, true))); + items.push_back (MenuElem (_("Fan out to Busses"), sigc::bind (sigc::mem_fun (*this, &RouteUI::fan_out), true, true))); + items.push_back (MenuElem (_("Fan out to Tracks"), sigc::bind (sigc::mem_fun (*this, &RouteUI::fan_out), false, true))); } items.push_back (SeparatorElem()); diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index c87cd159c6..cceb71dd5f 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -2352,11 +2352,15 @@ RouteUI::fan_out (bool to_busses, bool group) msg.run (); return; } + +#define BUSNAME pd.group_name + "(" + _route->name () + ")" + + /* count busses and channels/bus */ boost::shared_ptr<Plugin> plugin = pi->plugin (); std::map<std::string, uint32_t> busnames; for (uint32_t p = 0; p < n_outputs; ++p) { const Plugin::IOPortDescription& pd (plugin->describe_io_port (DataType::AUDIO, false, p)); - std::string bn = pi->name () + " " + pd.group_name; + std::string bn = BUSNAME; busnames[bn]++; } @@ -2377,7 +2381,7 @@ RouteUI::fan_out (bool to_busses, bool group) RouteList to_group; for (uint32_t p = 0; p < n_outputs; ++p) { const Plugin::IOPortDescription& pd (plugin->describe_io_port (DataType::AUDIO, false, p)); - std::string bn = pi->name () + " " + pd.group_name; + std::string bn = BUSNAME; boost::shared_ptr<Route> r = _session->route_by_name (bn); if (!r) { if (to_busses) { @@ -2394,15 +2398,28 @@ RouteUI::fan_out (bool to_busses, bool group) cl->push_back (r->monitoring_control ()); _session->set_controls (cl, (double) MonitorInput, Controllable::NoGroup); } + r->input ()->disconnect (this); } to_group.push_back (r); _route->output ()->audio (p)->connect (r->input ()->audio (pd.group_channel).get()); } +#undef BUSNAME if (group) { - RouteGroup* rg = new RouteGroup (*_session, pi->name ()); - _session->add_route_group (rg); - rg->set_gain (false); + RouteGroup* rg = NULL; + const std::list<RouteGroup*>& rgs (_session->route_groups ()); + for (std::list<RouteGroup*>::const_iterator i = rgs.begin (); i != rgs.end (); ++i) { + if ((*i)->name () == pi->name ()) { + rg = *i; + break; + } + } + if (!rg) { + rg = new RouteGroup (*_session, pi->name ()); + _session->add_route_group (rg); + rg->set_gain (false); + } + GroupTabs::set_group_color (rg, _route->presentation_info().color()); for (RouteList::const_iterator i = to_group.begin(); i != to_group.end(); ++i) { rg->add (*i); |