summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-06-20 18:46:05 +0000
committerCarl Hetherington <carl@carlh.net>2012-06-20 18:46:05 +0000
commit7a76e8ae96c20b270dd3104328f8bee199c9a770 (patch)
treeb2e81966aa9b87eddb7de53caddd6ba0da4d1697 /libs/ardour/session.cc
parentd863c200024d1e844f1b1d71471b85acfe671b36 (diff)
Declick before the end of seamless loops, not after the end, so that loops are rendered accurately (#4213, #4593).
git-svn-id: svn://localhost/ardour2/branches/3.0@12801 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 72c2a8654f..9eb4c223d0 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -929,10 +929,25 @@ Session::auto_punch_changed (Location* location)
replace_event (SessionEvent::PunchOut, when_to_stop);
}
+/** @param loc A loop location.
+ * @param pos Filled in with the start time of the required fade-out (in session frames).
+ * @param length Filled in with the length of the required fade-out.
+ */
+void
+Session::auto_loop_declick_range (Location* loc, framepos_t & pos, framepos_t & length)
+{
+ pos = max (loc->start(), loc->end() - 64);
+ length = loc->end() - pos;
+}
+
void
Session::auto_loop_changed (Location* location)
{
replace_event (SessionEvent::AutoLoop, location->end(), location->start());
+ framepos_t dcp;
+ framecnt_t dcl;
+ auto_loop_declick_range (location, dcp, dcl);
+ replace_event (SessionEvent::AutoLoopDeclick, dcp, dcl);
if (transport_rolling() && play_loop) {
@@ -1010,6 +1025,10 @@ Session::set_auto_loop_location (Location* location)
loop_connections.drop_connections ();
existing->set_auto_loop (false, this);
remove_event (existing->end(), SessionEvent::AutoLoop);
+ framepos_t dcp;
+ framecnt_t dcl;
+ auto_loop_declick_range (existing, dcp, dcl);
+ remove_event (dcp, SessionEvent::AutoLoopDeclick);
auto_loop_location_changed (0);
}