*/
+#include <map>
#include <boost/algorithm/string.hpp>
#include <gtkmm2ext/gtk_ui.h>
#include "ardour/vca.h"
#include "ardour/vca_manager.h"
#include "ardour/audio_track.h"
+#include "ardour/audio_port.h"
#include "ardour/audioengine.h"
#include "ardour/filename_extensions.h"
#include "ardour/midi_track.h"
#include "ardour/monitor_control.h"
#include "ardour/internal_send.h"
+#include "ardour/panner_shell.h"
#include "ardour/profile.h"
#include "ardour/phase_control.h"
#include "ardour/send.h"
_route->solo_safe_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
_route->solo_isolate_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::update_solo_display, this), gui_context());
_route->phase_control()->Changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::polarity_changed, this), gui_context());
+ _route->fan_out.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::fan_out, this, true, true), gui_context());
if (is_track()) {
track()->FreezeChange.connect (*this, invalidator (*this), boost::bind (&RouteUI::map_frozen, this), gui_context());
+#ifdef XXX_OLD_DESTRUCTIVE_API_XXX
track()->TrackModeChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::track_mode_changed, this), gui_context());
+#endif
track_mode_changed();
}
_mute_release->routes = copy;
}
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (copy, &Stripable::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::UseGroup);
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
_mute_release->routes = rl;
}
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (rl, &Stripable::mute_control), _route->muted_by_self() ? 0.0 : 1.0, Controllable::InverseGroup);
}
RouteUI::mute_release (GdkEventButton* /*ev*/)
{
if (_mute_release){
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (_mute_release->routes, &Stripable::mute_control), _mute_release->active, Controllable::UseGroup);
delete _mute_release;
_mute_release = 0;
_solo_release->routes = _session->get_routes ();
}
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (_session->get_routes(), &Stripable::solo_control), !_route->solo_control()->get_value(), Controllable::UseGroup);
} else if (Keyboard::modifier_state_contains (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::SecondaryModifier))) {
_solo_release->routes = rl;
}
- DisplaySuspender ds;
-
_session->set_controls (route_list_to_control_list (rl, &Stripable::solo_control), !_route->self_soloed(), Controllable::InverseGroup);
}
_solo_release->routes = rl;
}
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (rl, &Stripable::solo_control), !_route->self_soloed(), Controllable::UseGroup);
}
}
if (_solo_release->exclusive) {
} else {
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (_solo_release->routes, &Stripable::solo_control), _solo_release->active ? 1.0 : 0.0, Controllable::UseGroup);
}
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::ModifierMask (Keyboard::PrimaryModifier|Keyboard::TertiaryModifier))) {
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (_session->get_routes(), &Stripable::rec_enable_control), !track()->rec_enable_control()->get_value(), Controllable::NoGroup);
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
rl.reset (new RouteList);
rl->push_back (_route);
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (rl, &Stripable::rec_enable_control), !track()->rec_enable_control()->get_value(), Controllable::InverseGroup);
}
rl->push_back (route());
}
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (rl, &Stripable::monitoring_control), (double) mc, Controllable::UseGroup);
return false;
solo_isolated_check->set_active (yn);
}
- set_button_names ();
+ set_button_names ();
- if (solo_isolated_led) {
- if (_route->solo_isolate_control()->solo_isolated()) {
+ if (solo_isolated_led) {
+ if (_route->solo_isolate_control()->solo_isolated()) {
solo_isolated_led->set_active_state (Gtkmm2ext::ExplicitActive);
} else {
solo_isolated_led->unset_active_state ();
}
- }
+ }
- if (solo_safe_led) {
- if (_route->solo_safe_control()->solo_safe()) {
+ if (solo_safe_led) {
+ if (_route->solo_safe_control()->solo_safe()) {
solo_safe_led->set_active_state (Gtkmm2ext::ExplicitActive);
} else {
solo_safe_led->unset_active_state ();
}
- }
+ }
solo_button->set_active_state (solo_active_state (_route));
- /* some changes to solo status can affect mute display, so catch up
- */
+ /* some changes to solo status can affect mute display, so catch up
+ */
update_mute_display ();
}
if (model) {
/* disable isolate for all routes */
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (_session->get_routes(), &Stripable::solo_isolate_control), 0.0, Controllable::NoGroup);
} else {
/* enable isolate for all routes */
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (_session->get_routes(), &Stripable::solo_isolate_control), 1.0, Controllable::NoGroup);
}
boost::shared_ptr<RouteList> rl (new RouteList);
rl->push_back (_route);
- DisplaySuspender ds;
_session->set_controls (route_list_to_control_list (rl, &Stripable::solo_isolate_control), view ? 0.0 : 1.0, Controllable::NoGroup);
}
}
RouteUI::choose_color ()
{
bool picked;
- Gdk::Color c (gdk_color_from_rgb (_route->presentation_info().color()));
+ Gdk::Color c (gdk_color_from_rgba (_route->presentation_info().color()));
Gdk::Color const color = Gtkmm2ext::UI::instance()->get_color (_("Color Selection"), picked, &c);
if (picked) {
check_rec_enable_sensitivity ();
} else if (p == "use-monitor-bus" || p == "solo-control-is-listen-control" || p == "listen-position") {
set_button_names ();
+ } else if (p == "session-monitoring") {
+ update_monitoring_display ();
} else if (p == "auto-input") {
update_monitoring_display ();
} else if (p == "blink-rec-arm") {
_window = 0;
WM::Manager::instance().remove (this);
going_away_connection.disconnect();
+ delete this;
}
void
}
}
+void
+RouteUI::fan_out (bool to_busses, bool group)
+{
+ DisplaySuspender ds;
+ boost::shared_ptr<ARDOUR::Route> route = _route;
+ boost::shared_ptr<PluginInsert> pi = boost::dynamic_pointer_cast<PluginInsert> (route->the_instrument ());
+ assert (pi);
+
+ const uint32_t n_outputs = pi->output_streams ().n_audio ();
+ if (route->n_outputs ().n_audio () != n_outputs) {
+ MessageDialog msg (string_compose (
+ _("The Plugin's number of audio outputs ports (%1) does not match the Tracks's number of audio outputs (%2). Cannot fan out."),
+ n_outputs, route->n_outputs ().n_audio ()));
+ 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 = BUSNAME;
+ busnames[bn]++;
+ }
+
+ if (busnames.size () < 2) {
+ MessageDialog msg (_("Instrument has only 1 output bus. Nothing to fan out."));
+ msg.run ();
+ return;
+ }
+
+ uint32_t outputs = 2;
+ if (_session->master_out ()) {
+ outputs = std::max (outputs, _session->master_out ()->n_inputs ().n_audio ());
+ }
+
+ route->output ()->disconnect (this);
+ route->panner_shell ()->set_bypassed (true);
+
+ 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 = BUSNAME;
+ boost::shared_ptr<Route> r = _session->route_by_name (bn);
+ if (!r) {
+ if (to_busses) {
+ RouteList rl = _session->new_audio_route (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::AudioBus, PresentationInfo::max_order);
+ r = rl.front ();
+ assert (r);
+ } else {
+ list<boost::shared_ptr<AudioTrack> > tl =
+ _session->new_audio_track (busnames[bn], outputs, NULL, 1, bn, PresentationInfo::max_order, Normal);
+ r = tl.front ();
+ assert (r);
+
+ boost::shared_ptr<ControlList> cl (new ControlList);
+ 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 = 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);
+ }
+ }
+}
+
bool
RouteUI::mark_hidden (bool yn)
{