From 53773ec3101b130f63941ebcbe65c1be88a1fccf Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 1 Apr 2025 15:52:58 +0200 Subject: [PATCH] Prepare RouteUI for RTA --- gtk2_ardour/route_ui.cc | 34 +++++++++++++++++++++++++++++++++- gtk2_ardour/route_ui.h | 3 +++ gtk2_ardour/rta_manager.cc | 2 ++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 010890526c..e82b90164e 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -83,6 +83,7 @@ #include "rgb_macros.h" #include "route_time_axis.h" #include "route_ui.h" +#include "rta_manager.h" #include "save_template_dialog.h" #include "timers.h" #include "ui_config.h" @@ -214,6 +215,11 @@ RouteUI::init () solo_button->set_name ("solo button"); solo_button->set_no_show_all (true); + rta_button = manage (new ArdourButton); + rta_button->set_name ("rta button"); + rta_button->set_act_on_release (true); + rta_button->set_text (_("RTA")); + rec_enable_button = manage (new ArdourButton); rec_enable_button->set_name ("record enable button"); rec_enable_button->set_icon (ArdourIcon::RecButton); @@ -256,6 +262,8 @@ RouteUI::init () rec_enable_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_press), false); rec_enable_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::rec_enable_release), false); + rta_button->signal_clicked.connect (sigc::mem_fun(*this, &RouteUI::rta_clicked)); + show_sends_button->signal_button_press_event().connect (sigc::mem_fun(*this, &RouteUI::show_sends_press), false); show_sends_button->signal_button_release_event().connect (sigc::mem_fun(*this, &RouteUI::show_sends_release), false); @@ -391,6 +399,8 @@ RouteUI::set_route (std::shared_ptr rp) _route->solo_isolate_control()->Changed.connect (route_connections, invalidator (*this), std::bind (&RouteUI::update_solo_display, this), gui_context()); _route->phase_control()->Changed.connect (route_connections, invalidator (*this), std::bind (&RouteUI::update_polarity_display, this), gui_context()); + _route->gui_changed.connect (route_connections, invalidator (*this), std::bind (&RouteUI::handle_gui_changes, this, _1), gui_context()); + if (is_track()) { track()->FreezeChange.connect (*this, invalidator (*this), std::bind (&RouteUI::map_frozen, this), gui_context()); track_mode_changed(); @@ -435,6 +445,7 @@ RouteUI::set_route (std::shared_ptr rp) mute_button->set_can_focus (false); solo_button->set_can_focus (false); + rta_button->set_can_focus (false); mute_button->show(); @@ -454,6 +465,7 @@ RouteUI::set_route (std::shared_ptr rp) update_mute_display (); update_solo_display (); update_solo_button (); + handle_gui_changes ("rta"); if (!UIConfiguration::instance().get_blink_rec_arm()) { blink_rec_display(true); // set initial rec-en button state @@ -1189,6 +1201,27 @@ RouteUI::send_blink (bool onoff) } } +void +RouteUI::rta_clicked () +{ + bool attached = RTAManager::instance ()->attached (_route); + if (attached) { + RTAManager::instance ()->remove (_route); + } else { + RTAManager::instance ()->attach (_route); + ARDOUR_UI::instance()->show_realtime_analyzer (); + } +} + +void +RouteUI::handle_gui_changes (std::string const& what) +{ + if (what == "rta") { + bool attached = RTAManager::instance ()->attached (_route); + rta_button->set_active_state (attached ? Gtkmm2ext::ExplicitActive : Gtkmm2ext::Off); + } +} + Gtkmm2ext::ActiveState RouteUI::solo_active_state (std::shared_ptr s) { @@ -2820,4 +2853,3 @@ RouteUI::clear_time_domain (bool apply_to_selection) } } - diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 323d4094f0..9e863b8962 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -147,6 +147,7 @@ public: bool show_sends_release (GdkEventButton*); bool solo_isolate_button_release (GdkEventButton*); bool solo_safe_button_release (GdkEventButton*); + void rta_clicked (); bool monitor_release (GdkEventButton*, ARDOUR::MonitorChoice); bool monitor_input_press (GdkEventButton*); @@ -197,6 +198,7 @@ protected: ArdourWidgets::ArdourButton* show_sends_button; /* busses */ ArdourWidgets::ArdourButton* monitor_input_button; ArdourWidgets::ArdourButton* monitor_disk_button; + ArdourWidgets::ArdourButton* rta_button; ArdourWidgets::ArdourButton* solo_safe_led; ArdourWidgets::ArdourButton* solo_isolated_led; @@ -287,6 +289,7 @@ private: void session_rec_enable_changed (); void denormal_protection_changed (); void muting_change (); + void handle_gui_changes (std::string const&); void step_edit_changed (bool); void toggle_rec_safe (); diff --git a/gtk2_ardour/rta_manager.cc b/gtk2_ardour/rta_manager.cc index aebc8d6821..70b86483e7 100644 --- a/gtk2_ardour/rta_manager.cc +++ b/gtk2_ardour/rta_manager.cc @@ -180,6 +180,7 @@ RTAManager::attach (std::shared_ptr route) _rta.back ().set_rta_warp (_warp); _rta.back ().delivery ()->set_analysis_active (_active); + route->gui_changed ("rta", this); /* EMIT SIGNAL */ route->DropReferences.connect (*this, invalidator (*this), std::bind (&RTAManager::route_removed, this, std::weak_ptr (route)), gui_context ()); } @@ -187,6 +188,7 @@ void RTAManager::remove (std::shared_ptr route) { _rta.remove_if ([route] (RTAManager::RTA const& r) { return r.route () == route; }); + route->gui_changed ("rta", this); /* EMIT SIGNAL */ } bool