summaryrefslogtreecommitdiff
path: root/libs/ardour/playlist.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-02-01 04:26:22 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-02-01 04:26:22 +0000
commitbd3b9d763b0409c8e59d5ea38857d604e917818a (patch)
treed9d5dbb001901da5ab5522777055513a79522a77 /libs/ardour/playlist.cc
parent76c658ea48e1ad11b7f407d15e5e8c1e3e55ebb4 (diff)
large chunks of code to deal with pre-analysis of audio; transient/perconset data used for new tab-to-transient; all ArdourDialogs push the splash screen out of the way; try to keep verbose canvas cursor within the editor canvas visible area; fix template use from NSD
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2983 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/playlist.cc')
-rw-r--r--libs/ardour/playlist.cc75
1 files changed, 75 insertions, 0 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index f495e00510..aa79812f98 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -37,6 +37,7 @@
#include <ardour/region.h>
#include <ardour/region_factory.h>
#include <ardour/playlist_factory.h>
+#include <ardour/transient_detector.h>
#include "i18n.h"
@@ -1411,6 +1412,65 @@ Playlist::regions_touched (nframes_t start, nframes_t end)
return rlist;
}
+nframes64_t
+Playlist::find_next_transient (nframes64_t from, int dir)
+{
+ RegionLock rlock (this);
+ AnalysisFeatureList points;
+ AnalysisFeatureList these_points;
+
+ for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
+ if (dir > 0) {
+ if ((*i)->last_frame() < from) {
+ continue;
+ }
+ } else {
+ if ((*i)->first_frame() > from) {
+ continue;
+ }
+ }
+
+ (*i)->get_transients (these_points);
+
+ /* add first frame, just, err, because */
+
+ these_points.push_back ((*i)->first_frame());
+
+ points.insert (points.end(), these_points.begin(), these_points.end());
+ these_points.clear ();
+ }
+
+ if (points.empty()) {
+ return -1;
+ }
+
+ TransientDetector::cleanup_transients (points, _session.frame_rate(), 3.0);
+ bool reached = false;
+
+ if (dir > 0) {
+ for (AnalysisFeatureList::iterator x = points.begin(); x != points.end(); ++x) {
+ if ((*x) >= from) {
+ reached = true;
+ }
+
+ if (reached && (*x) > from) {
+ return *x;
+ }
+ }
+ } else {
+ for (AnalysisFeatureList::reverse_iterator x = points.rbegin(); x != points.rend(); ++x) {
+ if ((*x) <= from) {
+ reached = true;
+ }
+
+ if (reached && (*x) < from) {
+ return *x;
+ }
+ }
+ }
+
+ return -1;
+}
boost::shared_ptr<Region>
Playlist::find_next_region (nframes_t frame, RegionPoint point, int dir)
@@ -2209,3 +2269,18 @@ Playlist::region_is_shuffle_constrained (boost::shared_ptr<Region>)
return false;
}
+
+void
+Playlist::update_after_tempo_map_change ()
+{
+ RegionLock rlock (const_cast<Playlist*> (this));
+ RegionList copy (regions);
+
+ freeze ();
+
+ for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {
+ (*i)->update_position_after_tempo_map_change ();
+ }
+
+ thaw ();
+}