From 1f7db603891281c8ce426d7e400a132420a4af5b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 19 Mar 2019 05:27:17 +0100 Subject: [PATCH] Add convenience methods (mainly for scripting) --- libs/ardour/ardour/session_playlists.h | 2 ++ libs/ardour/session_playlists.cc | 28 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/libs/ardour/ardour/session_playlists.h b/libs/ardour/ardour/session_playlists.h index 66f4f2c537..226680f6eb 100644 --- a/libs/ardour/ardour/session_playlists.h +++ b/libs/ardour/ardour/session_playlists.h @@ -61,6 +61,8 @@ public: boost::shared_ptr find_crossfade (const PBD::ID &); void sync_all_regions_with_regions (); std::vector > playlists_for_track (boost::shared_ptr) const; + std::vector > get_used () const; + std::vector > get_unused () const; uint32_t n_playlists() const; private: diff --git a/libs/ardour/session_playlists.cc b/libs/ardour/session_playlists.cc index 2f66cd61b2..d0468b981e 100644 --- a/libs/ardour/session_playlists.cc +++ b/libs/ardour/session_playlists.cc @@ -521,6 +521,34 @@ SessionPlaylists::region_use_count (boost::shared_ptr region) const return cnt; } +vector > +SessionPlaylists::get_used () const +{ + vector > pl; + + Glib::Threads::Mutex::Lock lm (lock); + + for (List::const_iterator i = playlists.begin(); i != playlists.end(); ++i) { + pl.push_back (*i); + } + + return pl; +} + +vector > +SessionPlaylists::get_unused () const +{ + vector > pl; + + Glib::Threads::Mutex::Lock lm (lock); + + for (List::const_iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) { + pl.push_back (*i); + } + + return pl; +} + /** @return list of Playlists that are associated with a track */ vector > SessionPlaylists::playlists_for_track (boost::shared_ptr tr) const