summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorBen Loftis <ben@glw.com>2009-12-08 20:42:52 +0000
committerBen Loftis <ben@glw.com>2009-12-08 20:42:52 +0000
commit360b97a763c43c26c6423cf2e3df438927ecb8ae (patch)
treed643f87b64633b246f54b051adb7da0da3415658 /libs
parentc1a10ef31f5df38a8e2d0501be6dd22c4d3372fc (diff)
backport feature to show only tracks with regions under the playhead (thanks Carl) and fix Save As function (thanks Paul)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6327 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/playlist.h3
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/playlist.cc13
-rw-r--r--libs/ardour/session.cc31
4 files changed, 48 insertions, 1 deletions
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index 4848573f1e..54e081a403 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -112,7 +112,8 @@ class Playlist : public PBD::StatefulDestructible, public boost::enable_shared_f
boost::shared_ptr<Region> find_next_region (nframes_t frame, RegionPoint point, int dir);
nframes64_t find_next_region_boundary (nframes64_t frame, int dir);
bool region_is_shuffle_constrained (boost::shared_ptr<Region>);
-
+ bool has_region_at (nframes64_t const) const;
+
nframes64_t find_next_transient (nframes64_t position, int dir);
template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>, void *), void *arg);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index ad02c1f6f9..1d8ef51453 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -312,6 +312,8 @@ class Session : public PBD::StatefulDestructible
return routes.reader ();
}
+ boost::shared_ptr<RouteList> get_routes_with_regions_at (nframes64_t const) const;
+
uint32_t nroutes() const { return routes.reader()->size(); }
uint32_t ntracks () const;
uint32_t nbusses () const;
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index e8f51d361a..20a2aabe43 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -893,6 +893,19 @@ Playlist::partition_internal (nframes_t start, nframes_t end, bool cutting, Regi
}
}
+bool
+Playlist::has_region_at (nframes64_t const p) const
+{
+ RegionLock (const_cast<Playlist *> (this));
+
+ RegionList::const_iterator i = regions.begin ();
+ while (i != regions.end() && !(*i)->covers (p)) {
+ ++i;
+ }
+
+ return (i != regions.end());
+}
+
boost::shared_ptr<Playlist>
Playlist::cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(nframes_t, nframes_t,bool), list<AudioRange>& ranges, bool result_is_hidden)
{
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 2b235dae28..d511897b3b 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -1001,6 +1001,36 @@ Session::hookup_io ()
catch_up_on_solo();
}
+boost::shared_ptr<Session::RouteList>
+Session::get_routes_with_regions_at (nframes64_t const p) const
+{
+ shared_ptr<RouteList> r = routes.reader ();
+ shared_ptr<RouteList> rl (new RouteList);
+
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
+ if (!tr) {
+ continue;
+ }
+
+ boost::shared_ptr<Diskstream> ds = tr->diskstream ();
+ if (!ds) {
+ continue;
+ }
+
+ boost::shared_ptr<Playlist> pl = ds->playlist ();
+ if (!pl) {
+ continue;
+ }
+
+ if (pl->has_region_at (p)) {
+ rl->push_back (*i);
+ }
+ }
+
+ return rl;
+}
+
void
Session::playlist_length_changed ()
{
@@ -1673,6 +1703,7 @@ Session::resort_routes ()
}
}
+
void
Session::resort_routes_using (shared_ptr<RouteList> r)
{