diff --git a/libs/ardour/ardour/triggerbox.h b/libs/ardour/ardour/triggerbox.h index 998a1b282b..3adee3de7b 100644 --- a/libs/ardour/ardour/triggerbox.h +++ b/libs/ardour/ardour/triggerbox.h @@ -729,6 +729,8 @@ class LIBARDOUR_API TriggerBox : public Processor XMLNode& get_state () const; int set_state (const XMLNode&, int version); + void deep_sources (std::set>&); + void set_from_path (uint32_t slot, std::string const & path); void set_from_selection (uint32_t slot, boost::shared_ptr); diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 9f55e21ca6..552310b0e2 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -3667,8 +3667,17 @@ Session::cleanup_sources (CleanupReport& rep) _playlists->foreach (boost::bind (merge_all_sources, _1, &sources_used_by_this_snapshot)); - /* add our current source list - */ + { + boost::shared_ptr rl = routes.reader(); + for (auto const& r : *rl) { + boost::shared_ptr tb = r->triggerbox (); + if (tb) { + tb->deep_sources (sources_used_by_this_snapshot); + } + } + } + + /* add our current source list */ ls.acquire (); for (SourceMap::iterator i = sources.begin(); i != sources.end(); ) { diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index a5de1a359c..0f48378d30 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -3250,6 +3250,17 @@ TriggerBox::trigger_by_id (PBD::ID check) return TriggerPtr(); } +void +TriggerBox::deep_sources (std::set >& sources) +{ + for (uint64_t n = 0; n < all_triggers.size(); ++n) { + boost::shared_ptr r (trigger(n)->region ()); + if (r) { + r->deep_sources (sources); + } + } +} + void TriggerBox::enqueue_trigger_state_for_region (boost::shared_ptr region, boost::shared_ptr state) {