From 6a081375caf82a5f74cc4a6872384170e2b7335a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 15 May 2024 16:11:22 -0600 Subject: [PATCH] follow to 103dd00357441, continuing to refine/fix signal flow for livetrax --- libs/ardour/ardour/session.h | 4 ++++ libs/ardour/mute_master.cc | 11 +++++++-- libs/ardour/route.cc | 19 +++++++--------- libs/ardour/send.cc | 8 +++++-- libs/ardour/session.cc | 43 ++++++++++++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 15 deletions(-) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index bf98d7522a..11c4ad2e41 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1037,14 +1037,17 @@ public: uint32_t next_send_id(); uint32_t next_surround_send_id(); uint32_t next_aux_send_id(); + uint32_t next_direct_out_id(); uint32_t next_return_id(); uint32_t next_insert_id(); void mark_send_id (uint32_t); + void mark_direct_out_id (uint32_t); void mark_surround_send_id (uint32_t); void mark_aux_send_id (uint32_t); void mark_return_id (uint32_t); void mark_insert_id (uint32_t); void unmark_send_id (uint32_t); + void unmark_direct_out_id (uint32_t); void unmark_surround_send_id (uint32_t); void unmark_aux_send_id (uint32_t); void unmark_return_id (uint32_t); @@ -2113,6 +2116,7 @@ private: boost::dynamic_bitset send_bitset; boost::dynamic_bitset surround_send_bitset; boost::dynamic_bitset aux_send_bitset; + boost::dynamic_bitset direct_out_bitset; boost::dynamic_bitset return_bitset; boost::dynamic_bitset insert_bitset; diff --git a/libs/ardour/mute_master.cc b/libs/ardour/mute_master.cc index dbf5dbda19..bf786fdece 100644 --- a/libs/ardour/mute_master.cc +++ b/libs/ardour/mute_master.cc @@ -41,7 +41,7 @@ const string MuteMaster::xml_node_name (X_("MuteMaster")); const MuteMaster::MutePoint MuteMaster::AllPoints = MuteMaster::MutePoint( PreFader|PostFader|Listen|Main|SurroundSend); -MuteMaster::MuteMaster (Session& s, Muteable& m, const std::string&) +MuteMaster::MuteMaster (Session& s, Muteable& m, const std::string& name) : SessionHandleRef (s) , _muteable (&m) , _mute_point (MutePoint (0)) @@ -50,7 +50,6 @@ MuteMaster::MuteMaster (Session& s, Muteable& m, const std::string&) , _soloed_by_others (false) , _muted_by_masters (0) { - if (Config->get_mute_affects_pre_fader ()) { _mute_point = MutePoint (_mute_point | PreFader); } @@ -70,6 +69,10 @@ MuteMaster::MuteMaster (Session& s, Muteable& m, const std::string&) if (Config->get_mute_affects_surround_sends ()) { _mute_point = MutePoint (_mute_point | SurroundSend); } + +#ifdef LIVETRAX + _mute_point = MutePoint (_mute_point | PreFader); +#endif } void @@ -150,6 +153,10 @@ MuteMaster::set_state (const XMLNode& node, int version) { node.get_property ("mute-point", _mute_point); +#ifdef LIVETRAX + _mute_point = MutePoint (_mute_point | PreFader); +#endif + if (!node.get_property ("muted", _muted_by_self)) { _muted_by_self = (_mute_point != MutePoint (0)); } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 757d304611..2c261e13ee 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -3324,16 +3324,7 @@ Route::set_processor_state (XMLNode const& node, int version, XMLProperty const* if (prop->value() == "intsend") { - XMLProperty const * role_prop = node.property (X_("role")); - if (role_prop && role_prop->value() == "DirectOuts") { - if (Profile->get_livetrax()) { - create_direct_outs (); - assert (_direct_outs); - processor = _direct_outs; - } - } else { - processor.reset (new InternalSend (_session, _pannable, _mute_master, std::dynamic_pointer_cast(shared_from_this()), std::shared_ptr(), Delivery::Aux, true)); - } + processor.reset (new InternalSend (_session, _pannable, _mute_master, std::dynamic_pointer_cast(shared_from_this()), std::shared_ptr(), Delivery::Aux, true)); } else if (prop->value() == "ladspa" || prop->value() == "Ladspa" || prop->value() == "lv2" || @@ -3357,7 +3348,13 @@ Route::set_processor_state (XMLNode const& node, int version, XMLProperty const* } else if (prop->value() == "send") { - processor.reset (new Send (_session, _pannable, _mute_master, Delivery::Send, true)); + XMLProperty const * role_prop = node.property (X_("role")); + if (role_prop && role_prop->value() == "DirectOuts") { + _direct_outs.reset (new Send (_session, _pannable, _mute_master, Delivery::DirectOuts, true)); + processor = _direct_outs; + } else { + processor.reset (new Send (_session, _pannable, _mute_master, Delivery::Send, true)); + } std::shared_ptr send = std::dynamic_pointer_cast (processor); send->SelfDestruct.connect_same_thread (*send, boost::bind (&Route::processor_selfdestruct, this, std::weak_ptr (processor))); if (send->output()) { diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 1c95ca04e0..971a921d60 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -89,7 +89,7 @@ Send::name_and_id_new_send (Session& s, Role r, uint32_t& bitslot, bool ignore_b case Delivery::Foldback: return string_compose (_("foldback %1"), (bitslot = s.next_aux_send_id ())); case Delivery::DirectOuts: - return string_compose (_("directs %1"), (bitslot = s.next_aux_send_id ())); + return string_compose (_("directs %1"), (bitslot = s.next_direct_out_id ())); default: fatal << string_compose (_("programming error: send created using role %1"), enum_2_string (r)) << endmsg; abort(); /*NOTREACHED*/ @@ -414,6 +414,10 @@ Send::set_state (const XMLNode& node, int version) _session.unmark_send_id (_bitslot); _bitslot = string_to(prop->value()); _session.mark_send_id (_bitslot); + } else if (_role == Delivery::DirectOuts) { + _session.unmark_direct_out_id (_bitslot); + _bitslot = string_to(prop->value()); + _session.mark_direct_out_id (_bitslot); } else { // bitslot doesn't matter but make it zero anyway _bitslot = 0; @@ -559,7 +563,7 @@ Send::set_name (const string& new_name) bool Send::display_to_user () const { - if (_role == Delivery::DirectOuts && Profile->get_livetrax()) { + if (_role == DirectOuts) { return false; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 3794463a48..9c80d3bde8 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -6024,6 +6024,26 @@ Session::next_aux_send_id () } } +uint32_t +Session::next_direct_out_id () +{ + /* this doesn't really loop forever. just think about it */ + + while (true) { + for (boost::dynamic_bitset::size_type n = 1; n < direct_out_bitset.size(); ++n) { + if (!direct_out_bitset[n]) { + direct_out_bitset[n] = true; + return n; + + } + } + + /* none available, so resize and try again */ + + direct_out_bitset.resize (direct_out_bitset.size() + 16, false); + } +} + uint32_t Session::next_return_id () { @@ -6068,6 +6088,18 @@ Session::mark_aux_send_id (uint32_t id) aux_send_bitset[id] = true; } +void +Session::mark_direct_out_id (uint32_t id) +{ + if (id >= direct_out_bitset.size()) { + direct_out_bitset.resize (id+16, false); + } + if (direct_out_bitset[id]) { + warning << string_compose (_("direct out ID %1 appears to be in use already"), id) << endmsg; + } + direct_out_bitset[id] = true; +} + void Session::mark_surround_send_id (uint32_t id) { @@ -6115,6 +6147,17 @@ Session::unmark_send_id (uint32_t id) } } +void +Session::unmark_direct_out_id (uint32_t id) +{ + if (deletion_in_progress ()) { + return; + } + if (id < direct_out_bitset.size()) { + direct_out_bitset[id] = false; + } +} + void Session::unmark_aux_send_id (uint32_t id) {