From 9cc966120cdeba967ec084abc1817aac8ee31f71 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 27 Nov 2023 04:26:46 +0100 Subject: [PATCH] Consolidate internal bus checks (2/2) --- gtk2_ardour/duplicate_routes_dialog.cc | 8 +++----- gtk2_ardour/editor_ops.cc | 2 +- gtk2_ardour/export_channel_selector.cc | 4 ++-- gtk2_ardour/foldback_strip.cc | 2 +- gtk2_ardour/io_plugin_window.cc | 2 +- gtk2_ardour/meterbridge.cc | 3 +++ gtk2_ardour/mixer_group_tabs.cc | 4 ++-- gtk2_ardour/mixer_strip.cc | 8 ++++---- gtk2_ardour/mixer_ui.cc | 9 ++++++--- gtk2_ardour/processor_box.cc | 23 ++++++++++------------- gtk2_ardour/route_list_base.cc | 2 +- gtk2_ardour/route_time_axis.cc | 12 +++++++----- gtk2_ardour/route_ui.cc | 10 ++++++++-- gtk2_ardour/route_ui.h | 1 + gtk2_ardour/trigger_strip.cc | 4 ++-- 15 files changed, 52 insertions(+), 42 deletions(-) diff --git a/gtk2_ardour/duplicate_routes_dialog.cc b/gtk2_ardour/duplicate_routes_dialog.cc index d89a7d0eb7..4303d12ca5 100644 --- a/gtk2_ardour/duplicate_routes_dialog.cc +++ b/gtk2_ardour/duplicate_routes_dialog.cc @@ -99,10 +99,8 @@ DuplicateRouteDialog::restart (Session* s) if (std::dynamic_pointer_cast (r)) { ntracks++; - } else { - if (!r->is_master() && !r->is_monitor()) { - nbusses++; - } + } else if (!r->is_main_bus()) { + nbusses++; } } @@ -185,7 +183,7 @@ DuplicateRouteDialog::on_response (int response) continue; } - if ((*s)->is_master() || (*s)->is_monitor()) { + if ((*s)->is_main_bus ()) { /* no option to duplicate these */ continue; } diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index f316aacc8b..17157cd32e 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -8299,7 +8299,7 @@ Editor::_remove_tracks () } routes.push_back (rtv->route()); - if (rtv->route()->is_master() || rtv->route()->is_monitor()) { + if (rtv->route()->is_singleton ()) { special_bus = true; } } diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc index 60fe0a2115..f3795e3828 100644 --- a/gtk2_ardour/export_channel_selector.cc +++ b/gtk2_ardour/export_channel_selector.cc @@ -136,7 +136,7 @@ PortExportChannelSelector::fill_route_list () routes.sort (Stripable::Sorter ()); for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) { - if ((*it)->is_master () || (*it)->is_monitor ()) { + if ((*it)->is_main_bus ()) { continue; } if ((*it)->output()->n_ports ().n_audio () > 0) { @@ -838,7 +838,7 @@ TrackExportChannelSelector::fill_list() for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) { if (!std::dynamic_pointer_cast(*it)) { // not a track, must be a bus - if ((*it)->is_master () || (*it)->is_monitor ()) { + if ((*it)->is_main_bus ()) { continue; } if (!(*it)->active ()) { diff --git a/gtk2_ardour/foldback_strip.cc b/gtk2_ardour/foldback_strip.cc index 304e50c4aa..a3d69f1a0e 100644 --- a/gtk2_ardour/foldback_strip.cc +++ b/gtk2_ardour/foldback_strip.cc @@ -1060,7 +1060,7 @@ FoldbackStrip::create_selected_sends (ARDOUR::Placement p, bool) _session->get_stripables (*slist, fl); for (StripableList::iterator i = (*slist).begin (); i != (*slist).end (); ++i) { - if ((*i)->is_selected () && !(*i)->is_master () && !(*i)->is_monitor ()) { + if ((*i)->is_selected () && !(*i)->is_main_bus ()) { std::shared_ptr rt = std::dynamic_pointer_cast (*i); if (rt) { rt->add_foldback_send (_route, p == PostFader); diff --git a/gtk2_ardour/io_plugin_window.cc b/gtk2_ardour/io_plugin_window.cc index de25c645be..d94c386373 100644 --- a/gtk2_ardour/io_plugin_window.cc +++ b/gtk2_ardour/io_plugin_window.cc @@ -621,7 +621,7 @@ IOPluginWindow::IOButton::button_press (GdkEventButton* ev) if (_pre) { /* suggest connecting output of io-plugins running before process to route inputs */ for (auto const& i : copy) { - if (i->is_foldbackbus () || i->is_monitor ()) { + if (i->is_foldbackbus () || i->is_monitor () || i->is_surround_master ()) { continue; } maybe_add_bundle_to_menu (i->input ()->bundle ()); diff --git a/gtk2_ardour/meterbridge.cc b/gtk2_ardour/meterbridge.cc index 65adca2ce4..9245fd1e3b 100644 --- a/gtk2_ardour/meterbridge.cc +++ b/gtk2_ardour/meterbridge.cc @@ -536,6 +536,9 @@ Meterbridge::add_strips (RouteList& routes) if (route->is_monitor()) { continue; } + if (route->is_surround_master()) { + continue; + } strip = new MeterStrip (_session, route); strips.push_back (MeterBridgeStrip(strip)); diff --git a/gtk2_ardour/mixer_group_tabs.cc b/gtk2_ardour/mixer_group_tabs.cc index 26d2715922..f9bf029611 100644 --- a/gtk2_ardour/mixer_group_tabs.cc +++ b/gtk2_ardour/mixer_group_tabs.cc @@ -70,7 +70,7 @@ MixerGroupTabs::compute_tabs () const continue; } - if (s->route()->is_master() || s->route()->is_monitor() || !s->marked_for_display()) { + if (s->route()->is_main_bus () || !s->marked_for_display()) { continue; } #ifdef MIXBUS @@ -172,7 +172,7 @@ MixerGroupTabs::routes_for_tab (Tab const * t) const continue; } - if (s->route()->is_master() || s->route()->is_monitor() || !s->marked_for_display()) { + if (s->route()->is_main_bus () || !s->marked_for_display()) { continue; } diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 2c993a38ac..15bf275658 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -712,7 +712,7 @@ MixerStrip::set_route (std::shared_ptr rt) /* non-master bus */ - if (!_route->is_master()) { + if (!_route->is_main_bus ()) { if (ARDOUR::Profile->get_mixbus()) { rec_mon_table.attach (*show_sends_button, 0, 3, 0, 2); } else { @@ -1098,7 +1098,7 @@ MixerStrip::build_route_ops_menu () items.push_back (SeparatorElem()); } - if (!_route->is_master() + if (!_route->is_singleton () #ifdef MIXBUS && !_route->mixbus() #endif @@ -1118,7 +1118,7 @@ MixerStrip::build_route_ops_menu () items.push_back (SeparatorElem()); } - if ((!_route->is_master() || !active) + if ((!_route->is_singleton () || !active) #ifdef MIXBUS && !_route->mixbus() #endif @@ -1191,7 +1191,7 @@ MixerStrip::build_route_ops_menu () } #endif - if (!_route->is_master()) { + if (!_route->is_singleton ()) { items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Duplicate..."), sigc::mem_fun (*this, &RouteUI::duplicate_selected_routes))); items.push_back (SeparatorElem()); diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index f732269947..3f7f1069be 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -1467,7 +1467,7 @@ Mixer_UI::set_all_strips_visibility (bool yn) continue; } - if (strip->route()->is_master() || strip->route()->is_monitor()) { + if (strip->route()->is_singleton()) { continue; } @@ -1499,7 +1499,7 @@ Mixer_UI::set_all_audio_midi_visibility (int tracks, bool yn) continue; } - if (strip->route()->is_master() || strip->route()->is_monitor()) { + if (strip->route()->is_singleton()) { continue; } @@ -1770,7 +1770,7 @@ Mixer_UI::redisplay_track_list () } else { - if (stripable->is_master() || stripable->is_monitor()) { + if (stripable->is_singleton()) { /* do nothing, these cannot be hidden */ } else { if (strip->packed()) { @@ -2047,6 +2047,9 @@ Mixer_UI::stripable_property_changed (const PropertyChange& what_changed, std::w } } + if (s->is_surround_master ()) { + return; + } if (s->is_master ()) { return; } diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 705ae44fd5..32f0c3c8fe 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -2254,7 +2254,7 @@ ProcessorBox::build_possible_aux_menu () return 0; } - if (_route->is_monitor () || _route->is_foldbackbus () || _route->is_master ()) { + if (_route->is_main_bus ()) { return 0; } @@ -2263,11 +2263,8 @@ ProcessorBox::build_possible_aux_menu () MenuList& items = menu->items(); for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) { - if ((*r)->is_master() || (*r)->is_monitor () || *r == _route) { - /* don't allow sending to master or monitor or to self */ - continue; - } - if ((*r)->is_foldbackbus ()) { + if ((*r)->is_main_bus() || *r == _route) { + /* don't allow sending to master, monitor, folback, surround or to self */ continue; } if (_route->internal_send_for (*r)) { @@ -2290,7 +2287,7 @@ ProcessorBox::build_possible_listener_menu () return 0; } - if (_route->is_monitor () || _route->is_foldbackbus ()) { + if (_route->is_monitor () || _route->is_foldbackbus () || _route->is_surround_master ()) { return 0; } @@ -2299,8 +2296,8 @@ ProcessorBox::build_possible_listener_menu () MenuList& items = menu->items(); for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) { - if ((*r)->is_master() || (*r)->is_monitor () || *r == _route) { - /* don't allow sending to master or monitor or to self */ + if ((*r)->is_singleton () || *r == _route) { + /* don't allow sending to master or monitor, surround or to self */ continue; } if (!(*r)->is_foldbackbus ()) { @@ -2326,7 +2323,7 @@ ProcessorBox::build_possible_remove_listener_menu () return 0; } - if (_route->is_monitor () || _route->is_foldbackbus ()) { + if (_route->is_monitor () || _route->is_foldbackbus () || _route->is_surround_master ()) { return 0; } @@ -2335,7 +2332,7 @@ ProcessorBox::build_possible_remove_listener_menu () MenuList& items = menu->items(); for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) { - if ((*r)->is_master() || (*r)->is_monitor () || *r == _route) { + if ((*r)->is_singleton() || *r == _route) { /* don't allow sending to master or monitor or to self */ continue; } @@ -2415,8 +2412,8 @@ ProcessorBox::show_processor_menu (int arg) } } - ActionManager::get_action (X_("ProcessorMenu"), "newinsert")->set_sensitive (!_route->is_monitor () && !_route->is_foldbackbus ()); - ActionManager::get_action (X_("ProcessorMenu"), "newsend")->set_sensitive (!_route->is_monitor () && !_route->is_foldbackbus ()); + ActionManager::get_action (X_("ProcessorMenu"), "newinsert")->set_sensitive (!_route->is_monitor () && !_route->is_foldbackbus () && !_route->is_surround_master ()); + ActionManager::get_action (X_("ProcessorMenu"), "newsend")->set_sensitive (!_route->is_monitor () && !_route->is_foldbackbus () && !_route->is_surround_master ()); ProcessorEntry* single_selection = 0; if (processor_display.selection().size() == 1) { diff --git a/gtk2_ardour/route_list_base.cc b/gtk2_ardour/route_list_base.cc index 2f0fef4bb6..da879fabae 100644 --- a/gtk2_ardour/route_list_base.cc +++ b/gtk2_ardour/route_list_base.cc @@ -585,7 +585,7 @@ RouteListBase::add_stripables (StripableList& slist) midi_trk = std::dynamic_pointer_cast (stripable); row[_columns.is_track] = (std::dynamic_pointer_cast (stripable) != 0); - row[_columns.activatable] = !stripable->is_master (); + row[_columns.activatable] = !stripable->is_singleton (); if (midi_trk) { row[_columns.is_input_active] = midi_trk->input_active (); diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index d1bf759804..9f5c0407d5 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -807,7 +807,7 @@ RouteTimeAxisView::build_display_menu () r.push_back (route ()); } - if (!_route->is_master()) { + if (!_route->is_singleton ()) { route_group_menu->build (r); items.push_back (MenuElem (_("Group"), *route_group_menu->menu ())); } @@ -826,7 +826,7 @@ RouteTimeAxisView::build_display_menu () if (!r) { continue; } - always_active |= r->route()->is_master(); + always_active |= r->route()->is_singleton (); #ifdef MIXBUS always_active |= r->route()->mixbus() != 0; #endif @@ -885,12 +885,14 @@ RouteTimeAxisView::build_display_menu () items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Hide"), sigc::bind (sigc::mem_fun(_editor, &PublicEditor::hide_track_in_display), this, true))); - if (_route && !_route->is_master()) { + + if (_route && !_route->is_singleton ()) { items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Duplicate..."), boost::bind (&ARDOUR_UI::start_duplicate_routes, ARDOUR_UI::instance()))); + + items.push_back (SeparatorElem()); + items.push_back (MenuElem (_("Remove"), sigc::mem_fun(_editor, &PublicEditor::remove_tracks))); } - items.push_back (SeparatorElem()); - items.push_back (MenuElem (_("Remove"), sigc::mem_fun(_editor, &PublicEditor::remove_tracks))); } void diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index e7714a17f5..08782b74dc 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -517,7 +517,7 @@ RouteUI::mute_press (GdkEventButton* ev) *copy = _session->get_stripables (); for (StripableList::iterator i = copy->begin(); i != copy->end(); ) { - if ((*i)->is_master() || (*i)->is_monitor()) { + if ((*i)->is_singleton ()) { i = copy->erase (i); } else { ++i; @@ -1817,7 +1817,7 @@ RouteUI::set_route_active (bool a, bool apply_to_selection) { if (apply_to_selection) { ARDOUR_UI::instance()->the_editor().get_selection().tracks.foreach_route_ui (boost::bind (&RouteUI::set_route_active, _1, a, false)); - } else if (!is_master () + } else if (!is_singleton () #ifdef MIXBUS && !_route->mixbus() #endif @@ -1879,6 +1879,12 @@ RouteUI::is_master () const return _route && _route->is_master (); } +bool +RouteUI::is_singleton () const +{ + return _route && _route->is_singleton (); +} + bool RouteUI::is_foldbackbus () const { diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h index 88926ac700..03b3323372 100644 --- a/gtk2_ardour/route_ui.h +++ b/gtk2_ardour/route_ui.h @@ -104,6 +104,7 @@ public: bool is_track () const; bool is_master () const; bool is_foldbackbus () const; + bool is_singleton () const; bool is_audio_track () const; bool is_midi_track () const; bool has_audio_outputs () const; diff --git a/gtk2_ardour/trigger_strip.cc b/gtk2_ardour/trigger_strip.cc index 5d828fa742..6fe8a1eca9 100644 --- a/gtk2_ardour/trigger_strip.cc +++ b/gtk2_ardour/trigger_strip.cc @@ -262,7 +262,7 @@ TriggerStrip::build_route_ops_menu () items.push_back (SeparatorElem()); } - if ((!_route->is_master() || !active) + if ((!_route->is_singleton () || !active) #ifdef MIXBUS && !_route->mixbus() #endif @@ -325,7 +325,7 @@ TriggerStrip::build_route_ops_menu () } #endif - if (!_route->is_master()) { + if (!_route->is_singleton ()) { items.push_back (SeparatorElem()); items.push_back (MenuElem (_("Duplicate..."), sigc::mem_fun (*this, &RouteUI::duplicate_selected_routes))); items.push_back (SeparatorElem());