+ DEBUG_TRACE (DEBUG::Transport, string_compose ("locate tracks to %1\n", _transport_frame));
+
+ if (Config->get_loop_is_mode() && get_play_loop()) {
+
+ Location *loc = _locations->auto_loop_location();
+
+ if (!loc || (_transport_frame < loc->start() || _transport_frame >= loc->end())) {
+ /* jumped out of loop range: stop tracks from looping,
+ but leave loop (mode) enabled.
+ */
+ set_track_loop (false);
+
+ } else if (loc && Config->get_seamless_loop() &&
+ ((loc->start() <= _transport_frame) ||
+ (loc->end() > _transport_frame) ) ) {
+
+ /* jumping to start of loop. This might have been done before but it is
+ * idempotent and cheap. Doing it here ensures that when we start playback
+ * outside the loop we still flip tracks into the magic seamless mode
+ * when needed.
+ */
+ set_track_loop (true);
+
+ } else if (loc) {
+ set_track_loop (false);
+ }
+
+ } else {
+
+ /* no more looping .. should have been noticed elsewhere */
+ }
+
+
+ {
+ LocaleGuard lg; // see note for non_realtime_locate() above
+ boost::shared_ptr<RouteList> rl = routes.reader();
+ for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
+ (*i)->non_realtime_locate (_transport_frame);
+ }
+ }
+
+ _scene_changer->locate (_transport_frame);
+
+ /* XXX: it would be nice to generate the new clicks here (in the non-RT thread)
+ rather than clearing them so that the RT thread has to spend time constructing
+ them (in Session::click).
+ */
+ clear_clicks ();
+}
+
+#ifdef USE_TRACKS_CODE_FEATURES
+bool
+Session::select_playhead_priority_target (framepos_t& jump_to)
+{
+ jump_to = -1;
+
+ AutoReturnTarget autoreturn = Config->get_auto_return_target_list ();
+
+ if (!autoreturn) {
+ return false;
+ }
+
+ if (Profile->get_trx() && transport_rolling() ) {
+ // We're playing, so do nothing.
+ // Next stop will put us where we need to be.
+ return false;
+ }
+
+ /* Note that the order of checking each AutoReturnTarget flag defines
+ the priority each flag.
+
+ Ardour/Mixbus: Last Locate
+ Range Selection
+ Loop Range
+ Region Selection
+
+ Tracks: Range Selection
+ Loop Range
+ Region Selection
+ Last Locate
+ */
+
+ if (autoreturn & RangeSelectionStart) {
+ if (!_range_selection.empty()) {
+ jump_to = _range_selection.from;
+ } else {
+ if (transport_rolling ()) {
+ /* Range selection no longer exists, but we're playing,
+ so do nothing. Next stop will put us where
+ we need to be.
+ */
+ return false;
+ }
+ }
+ }
+
+ if (jump_to < 0 && (autoreturn & Loop) && get_play_loop()) {
+ /* don't try to handle loop play when synced to JACK */
+
+ if (!synced_to_engine()) {
+ Location *location = _locations->auto_loop_location();
+
+ if (location) {
+ jump_to = location->start();
+
+ if (Config->get_seamless_loop()) {
+ /* need to get track buffers reloaded */
+ set_track_loop (true);
+ }
+ }
+ }
+ }
+
+ if (jump_to < 0 && (autoreturn & RegionSelectionStart)) {
+ if (!_object_selection.empty()) {
+ jump_to = _object_selection.from;
+ }
+ }