summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2019-11-01 21:14:40 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2019-11-01 21:25:20 -0600
commite0493814ecc73c09d2b7ebdee7a9778a3e5a069f (patch)
tree532de87c55d01dda90871237a3b04f8209a03eb4 /libs/ardour/session.cc
parente4caef2c720eb5dc1a9a59fc67a0f2e244513af4 (diff)
fix the way Session::auto_loop_changed() works to put back various things removed since 5.x
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc48
1 files changed, 30 insertions, 18 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 87901be800..c617686f9d 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -1431,33 +1431,45 @@ void
Session::auto_loop_changed (Location* location)
{
replace_event (SessionEvent::AutoLoop, location->end(), location->start());
- samplepos_t dcp;
- samplecnt_t dcl;
- auto_loop_declick_range (location, dcp, dcl);
- bool rolling = transport_rolling ();
+ const bool rolling = transport_rolling ();
- if (rolling && play_loop) {
+ if (rolling) {
- if (_transport_sample < location->start() || _transport_sample > location->end()) {
- // relocate to beginning of loop
- clear_events (SessionEvent::LocateRoll);
- request_locate (location->start(), true);
+ if (play_loop) {
+ if (_transport_sample < location->start() || _transport_sample > location->end()) {
+ // new loop range excludes current transport
+ // sample => relocate to beginning of loop
+ request_locate (location->start(), true);
+
+ } else if (!loop_changing) {
+
+ // schedule a locate-roll to refill the diskstreams at the
+ // previous loop end
+
+ loop_changing = true;
+
+ if (location->end() > last_loopend) {
+ clear_events (SessionEvent::LocateRoll);
+ SessionEvent *ev = new SessionEvent (SessionEvent::LocateRoll, SessionEvent::Add, last_loopend, last_loopend, 0, true);
+ queue_event (ev);
+ }
+ }
}
+
} else {
- clear_events (SessionEvent::AutoLoop);
- }
- /* possibly move playhead if not rolling; if we are rolling we'll move
- to the loop start on stop if that is appropriate.
- */
+ /* possibly move playhead if not rolling; if we are rolling we'll move
+ to the loop start on stop if that is appropriate.
+ */
- samplepos_t pos;
+ samplepos_t pos;
- if (!rolling && select_playhead_priority_target (pos)) {
- if (pos == location->start()) {
- request_locate (pos);
+ if (select_playhead_priority_target (pos)) {
+ if (pos == location->start()) {
+ request_locate (pos);
+ }
}
}