From 3de600625f86285a6f2280165b8746ea18ec51ae Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 27 Nov 2023 04:21:59 +0100 Subject: [PATCH] Consolidate internal bus checks (1/2) --- libs/ardour/internal_send.cc | 3 ++- libs/ardour/route.cc | 6 +++--- libs/ardour/selection.cc | 2 +- libs/ardour/session.cc | 6 +++--- libs/ardour/session_state.cc | 2 +- libs/ardour/stripable.cc | 10 ++++++---- libs/ardour/vst3_plugin.cc | 6 +++--- libs/surfaces/faderport8/actions.cc | 4 ++-- libs/surfaces/faderport8/faderport8.cc | 5 +++++ libs/surfaces/mackie/mcp_buttons.cc | 3 +-- libs/surfaces/osc/osc.cc | 2 ++ session_utils/copy-mixer.cc | 6 +++--- 12 files changed, 32 insertions(+), 23 deletions(-) diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index a86051ccb3..8e5dd817c2 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -107,7 +107,7 @@ InternalSend::propagate_solo () /* propagate further downstream alike Route::input_change_handler() */ std::shared_ptr routes = _session.get_routes (); for (auto const& i : *routes) { - if (i == _send_to || i->is_master() || i->is_monitor() || i->is_auditioner()) { + if (i == _send_to || i->is_singleton () || i->is_auditioner()) { continue; } bool does_feed = _send_to->feeds (i); @@ -247,6 +247,7 @@ InternalSend::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sa } } } + } else if (role () == Listen) { /* We're going to the monitor bus, so discard MIDI data */ diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index ee7e29382d..3cea82fdff 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -155,7 +155,7 @@ int Route::init () { /* default master bus to use strict i/o */ - if (is_master() || is_monitor ()) { + if (is_singleton ()) { _strict_io = true; _meter_point = _pending_meter_point = MeterOutput; } @@ -221,7 +221,7 @@ Route::init () _amp->set_display_name (_("Monitor")); } - if (!is_master() && !is_monitor() && !is_auditioner()) { + if (!is_singleton () && !is_auditioner ()) { _delayline.reset (new DelayLine (_session, name ())); } @@ -5435,7 +5435,7 @@ Route::setup_invisible_processors () } } - if (!is_master() && !is_monitor() && !is_auditioner()) { + if (!is_singleton () && !is_auditioner()) { ProcessorList::iterator reader_pos = find (new_processors.begin(), new_processors.end(), _disk_reader); if (reader_pos != new_processors.end()) { /* insert before disk-reader */ diff --git a/libs/ardour/selection.cc b/libs/ardour/selection.cc index 2dac79745d..11a7477a9b 100644 --- a/libs/ardour/selection.cc +++ b/libs/ardour/selection.cc @@ -163,7 +163,7 @@ CoreSelection::select_stripable_and_maybe_group (std::shared_ptr s, b /* monitor is never selectable */ - if (s->is_monitor()) { + if (s->is_monitor() || s->is_surround_master ()) { return false; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index ddc7eab165..fc5a9d1bb9 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2724,7 +2724,7 @@ Session::ensure_stripable_sort_order () for (StripableList::iterator si = sl.begin(); si != sl.end(); ++si) { std::shared_ptr s (*si); assert (!s->is_auditioner ()); // XXX remove me - if (s->is_monitor ()) { + if (s->is_monitor () || s->is_surround_master ()) { continue; } if (order != s->presentation_info().order()) { @@ -3519,7 +3519,7 @@ Session::add_internal_send (std::shared_ptr dest, int index, std::shared_ void Session::add_internal_send (std::shared_ptr dest, std::shared_ptr before, std::shared_ptr sender) { - if (sender->is_monitor() || sender->is_master() || sender == dest || dest->is_monitor() || dest->is_master()) { + if (sender->is_singleton() || sender == dest || dest->is_singleton()) { return; } @@ -4363,7 +4363,7 @@ Session::reassign_track_numbers () assert (!(*i)->is_auditioner()); if (std::dynamic_pointer_cast (*i)) { (*i)->set_track_number(++tn); - } else if (!(*i)->is_master() && !(*i)->is_monitor()) { + } else if (!(*i)->is_main_bus ()) { (*i)->set_track_number(--bn); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 2692e9d3eb..10ca7e1fa1 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -1118,7 +1118,7 @@ Session::export_track_state (std::shared_ptr rl, const string& path) if ((*i)->is_auditioner()) { continue; } - if ((*i)->is_master() || (*i)->is_monitor()) { + if ((*i)->is_singleton()) { continue; } child->add_child_nocopy ((*i)->get_state()); diff --git a/libs/ardour/stripable.cc b/libs/ardour/stripable.cc index 5e4f185346..085514f37d 100644 --- a/libs/ardour/stripable.cc +++ b/libs/ardour/stripable.cc @@ -141,10 +141,12 @@ Stripable::Sorter::operator() (std::shared_ptr a, std::shared int cmp_a = 0; int cmp_b = 0; - if (a->is_auditioner ()) { cmp_a = -2; } - if (b->is_auditioner ()) { cmp_b = -2; } - if (a->is_monitor ()) { cmp_a = -1; } - if (b->is_monitor ()) { cmp_b = -1; } + if (a->is_auditioner ()) { cmp_a = -3; } + if (b->is_auditioner ()) { cmp_b = -3; } + if (a->is_monitor ()) { cmp_a = -2; } + if (b->is_monitor ()) { cmp_b = -2; } + if (a->is_surround_master ()) { cmp_a = -1; } + if (b->is_surround_master ()) { cmp_b = -1; } /* ARDOUR-Editor: [Track|Bus|Master] (0) < VCA (3) * ARDOUR-Mixer : [Track|Bus] (0) < VCA (3) < Master (4) diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index bb2c5e8ef1..62ee687d51 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -2649,7 +2649,7 @@ VST3PI::stripable_property_changed (PBD::PropertyChange const&) std::string ns; int order_key; - if (s->is_master ()) { + if (s->is_master () || s->is_surround_master ()) { ns = _("Master"); order_key = 2; } else if (s->is_monitor ()) { @@ -2815,7 +2815,7 @@ VST3PI::getContextInfoValue (int32& value, FIDString id) if (0 == strcmp (id, ContextInfo::kIndexMode)) { value = ContextInfo::kFlatIndex; } else if (0 == strcmp (id, ContextInfo::kType)) { - if (s->is_master ()) { + if (s->is_singleton ()) { value = ContextInfo::kOut; } else if (s->presentation_info ().flags () & PresentationInfo::AudioTrack) { value = ContextInfo::kTrack; @@ -2825,7 +2825,7 @@ VST3PI::getContextInfoValue (int32& value, FIDString id) value = ContextInfo::kBus; } } else if (0 == strcmp (id, ContextInfo::kMain)) { - value = s->is_master () ? 1 : 0; + value = s->is_singleton () ? 1 : 0; } else if (0 == strcmp (id, ContextInfo::kIndex)) { value = s->presentation_info ().order (); } else if (0 == strcmp (id, ContextInfo::kColor)) { diff --git a/libs/surfaces/faderport8/actions.cc b/libs/surfaces/faderport8/actions.cc index d448dd1d8f..f26cc16eac 100644 --- a/libs/surfaces/faderport8/actions.cc +++ b/libs/surfaces/faderport8/actions.cc @@ -276,7 +276,7 @@ FaderPort8::button_automation (ARDOUR::AutoState as) StripableList all; session->get_stripables (all); for (StripableList::const_iterator i = all.begin(); i != all.end(); ++i) { - if ((*i)->is_master() || (*i)->is_monitor()) { + if ((*i)->is_singleton ()) { continue; } if (!(*i)->is_selected()) { @@ -328,7 +328,7 @@ FaderPort8::button_solo_clear () StripableList all; session->get_stripables (all); for (StripableList::const_iterator i = all.begin(); i != all.end(); ++i) { - if ((*i)->is_master() || (*i)->is_auditioner() || (*i)->is_monitor()) { + if ((*i)->is_singleton () || (*i)->is_auditioner()) { continue; } std::shared_ptr sc = (*i)->solo_control(); diff --git a/libs/surfaces/faderport8/faderport8.cc b/libs/surfaces/faderport8/faderport8.cc index 533f92f37c..029a1589fc 100644 --- a/libs/surfaces/faderport8/faderport8.cc +++ b/libs/surfaces/faderport8/faderport8.cc @@ -968,6 +968,7 @@ FaderPort8::filter_stripables (StripableList& strips) const bool allow_master = false; bool allow_monitor = false; + bool allow_surround = false; switch (_ctrls.mix_mode ()) { case MixAudio: @@ -987,11 +988,13 @@ FaderPort8::filter_stripables (StripableList& strips) const break; case MixUser: allow_master = true; + allow_surround = true; flt = &flt_selected; break; case MixOutputs: allow_master = true; allow_monitor = true; + allow_surround = true; flt = &flt_mains; break; case MixInputs: @@ -1005,6 +1008,7 @@ FaderPort8::filter_stripables (StripableList& strips) const /* fallthrough */ case MixAll: allow_master = true; + allow_surround = true; flt = &flt_all; break; } @@ -1018,6 +1022,7 @@ FaderPort8::filter_stripables (StripableList& strips) const if (!allow_master && (*s)->is_master ()) { continue; } if (!allow_monitor && (*s)->is_monitor ()) { continue; } + if (!allow_surround && (*s)->is_surround_master ()) { continue; } if ((*flt)(*s)) { strips.push_back (*s); diff --git a/libs/surfaces/mackie/mcp_buttons.cc b/libs/surfaces/mackie/mcp_buttons.cc index 69ea5cfc31..5732ee2fbc 100644 --- a/libs/surfaces/mackie/mcp_buttons.cc +++ b/libs/surfaces/mackie/mcp_buttons.cc @@ -1260,8 +1260,7 @@ MackieControlProtocol::prog2_clear_solo_press (Button &) for (StripableList::const_iterator i = sl.begin(); i != sl.end(); ++i) { std::shared_ptr mc = (*i)->mute_control(); - if (!mc->muted() && (!(*i)->is_master()) && (!(*i)->is_monitor())) - { + if (!mc->muted() && !(*i)->is_singleton ()) { mc->set_value(1.0, Controllable::UseGroup); } } diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 345437810c..506b68f2bb 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -1065,6 +1065,8 @@ OSC::routes_list (lo_message msg) lo_message_add_string (reply, "MA"); } else if (s->is_monitor()) { lo_message_add_string (reply, "MO"); + } else if (s->is_surround_master()) { + lo_message_add_string (reply, "SM"); } else if (std::dynamic_pointer_cast(s) && !std::dynamic_pointer_cast(s)) { if (!(s->presentation_info().flags() & PresentationInfo::MidiBus)) { if (s->is_foldbackbus()) { diff --git a/session_utils/copy-mixer.cc b/session_utils/copy-mixer.cc index deaf40eff4..95697f0b8a 100644 --- a/session_utils/copy-mixer.cc +++ b/session_utils/copy-mixer.cc @@ -138,7 +138,7 @@ copy_session_routes ( /* get route state from first session */ std::shared_ptr rl = s->get_routes (); for (auto const& r : *rl) { - if (r->is_master () || r->is_monitor () || r->is_auditioner ()) { + if (r->is_singleton () || r->is_auditioner ()) { continue; } XMLNode& state (r->get_state ()); @@ -178,7 +178,7 @@ copy_session_routes ( rl = s->get_routes (); for (auto const& r : *rl) { /* skip special busses */ - if (r->is_master () || r->is_monitor () || r->is_auditioner ()) { + if (r->is_singleton () || r->is_auditioner ()) { continue; } if (std::dynamic_pointer_cast (r)) { @@ -204,7 +204,7 @@ copy_session_routes ( rl = s->get_routes (); for (auto const& r : *rl) { /* skip special busses */ - if (r->is_master () || r->is_monitor () || r->is_auditioner ()) { + if (r->is_singleton () || r->is_auditioner ()) { continue; } if (!std::dynamic_pointer_cast (r)) {