From d6315618da305a99932799998102e9d00cd28951 Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Tue, 18 Feb 2020 20:15:05 -0600 Subject: Enumerate the polarity buttons from the polarity processor itself, not the Input count. --- gtk2_ardour/route_ui.cc | 20 +++++++++++++------- gtk2_ardour/route_ui.h | 1 + libs/ardour/ardour/route.h | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index a22eca4a18..15c04c8e55 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -50,6 +50,7 @@ #include "ardour/monitor_control.h" #include "ardour/internal_send.h" #include "ardour/panner_shell.h" +#include "ardour/polarity_processor.h" #include "ardour/profile.h" #include "ardour/phase_control.h" #include "ardour/send.h" @@ -351,7 +352,7 @@ RouteUI::set_route (boost::shared_ptr rp) _route->PropertyChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_property_changed, this, _1), gui_context()); _route->presentation_info().PropertyChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::route_gui_changed, this, _1), gui_context ()); - _route->io_changed.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::setup_invert_buttons, this), gui_context ()); + _route->polarity()->ConfigurationChanged.connect (route_connections, invalidator (*this), boost::bind (&RouteUI::polarity_configuration_changed, this, _1, _2), gui_context()); if (_session->writable() && is_track()) { boost::shared_ptr t = boost::dynamic_pointer_cast(_route); @@ -2016,6 +2017,12 @@ RouteUI::parameter_changed (string const & p) } } +void +RouteUI::polarity_configuration_changed (const ChanCount in, const ChanCount out) +{ + setup_invert_buttons(); +} + void RouteUI::setup_invert_buttons () { @@ -2026,12 +2033,11 @@ RouteUI::setup_invert_buttons () _invert_buttons.clear (); - if (!_route || !_route->input()) { + if (!_route) { return; } - uint32_t const N = _route->input()->n_ports().n_audio (); - + uint32_t const N = _route->phase_control()->size(); uint32_t const to_add = (N <= _max_invert_buttons) ? N : 1; for (uint32_t i = 0; i < to_add; ++i) { @@ -2067,7 +2073,7 @@ RouteUI::setup_invert_buttons () void RouteUI::set_invert_button_state () { - uint32_t const N = _route->input()->n_ports().n_audio(); + uint32_t const N = _route->phase_control()->size(); if (N > _max_invert_buttons) { /* One button for many channels; explicit active if all channels are inverted, @@ -2100,7 +2106,7 @@ bool RouteUI::invert_release (GdkEventButton* ev, uint32_t i) { if (ev->button == 1 && i < _invert_buttons.size()) { - uint32_t const N = _route->input()->n_ports().n_audio (); + uint32_t const N = _route->phase_control()->size(); if (N <= _max_invert_buttons) { /* left-click inverts phase so long as we have a button per channel */ _route->phase_control()->set_phase_invert (i, !_invert_buttons[i]->get_active()); @@ -2116,7 +2122,7 @@ RouteUI::invert_press (GdkEventButton* ev) { using namespace Menu_Helpers; - uint32_t const N = _route->input()->n_ports().n_audio(); + uint32_t const N = _route->phase_control()->size(); if (N <= _max_invert_buttons && ev->button != 3) { /* If we have an invert button per channel, we only pop up a menu on right-click; left click is handled diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 82a0ee1ec4..85e9ebff22 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -186,6 +186,7 @@ public: virtual void processors_changed (ARDOUR::RouteProcessorChange) {} void route_rec_enable_changed(); void session_rec_enable_changed(); + void polarity_configuration_changed (const ARDOUR::ChanCount in, const ARDOUR::ChanCount out); void build_solo_menu (); diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 2684cdc7ba..f53efe3fd2 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -205,6 +205,7 @@ public: boost::shared_ptr amp() const { return _amp; } boost::shared_ptr trim() const { return _trim; } + boost::shared_ptr polarity() const { return _polarity; } boost::shared_ptr peak_meter() { return _meter; } boost::shared_ptr peak_meter() const { return _meter; } boost::shared_ptr shared_peak_meter() const { return _meter; } -- cgit v1.2.3