summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-10-26 17:24:08 +0000
committerDavid Robillard <d@drobilla.net>2009-10-26 17:24:08 +0000
commit8d168bda874ae05b142e122cb48407ee4e1b442d (patch)
tree0f1c6d0fb7f463b66dfc521fad2e57e661f0d6f5 /libs/ardour/session.cc
parentfa5aeb7892fb73d45782b42da731bc5a51418e79 (diff)
Remove cyclic Source->Playlist references (and with it all dependence on Playlist from Source and children and a bunch of finicky reference managing code).
git-svn-id: svn://localhost/ardour2/branches/3.0@5925 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 1b054fd6fb..d9c83a3ff3 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -3004,6 +3004,23 @@ Session::remove_source (boost::weak_ptr<Source> src)
}
}
+/** Return the number of playlists (not regions) that contain @a src */
+uint32_t
+Session::source_use_count (boost::shared_ptr<const Source> src) const
+{
+ uint32_t count = 0;
+ for (PlaylistList::const_iterator p = playlists.begin(); p != playlists.end(); ++p) {
+ for (Playlist::RegionList::const_iterator r = (*p)->region_list().begin();
+ r != (*p)->region_list().end(); ++r) {
+ if ((*r)->uses_source(src)) {
+ ++count;
+ break;
+ }
+ }
+ }
+ return count;
+}
+
boost::shared_ptr<Source>
Session::source_by_id (const PBD::ID& id)
{