goodbye USE_TRACKS_CODE_FEATURES and is_tracks_build
[ardour.git] / libs / ardour / session_transport.cc
index 798091209c8182f2d9ecd36fab8e4d63a6d791e0..dbda0aabb3a3ebe2e6be24443d9ca2d6e31901ab 100644 (file)
@@ -116,10 +116,6 @@ Session::realtime_stop (bool abort, bool clear_state)
 
        DEBUG_TRACE (DEBUG::Transport, string_compose ("stop complete, auto-return scheduled for return to %1\n", _requested_return_sample));
 
-       /* the duration change is not guaranteed to have happened, but is likely */
-
-       todo = PostTransportWork (todo | PostTransportDuration);
-
        if (abort) {
                todo = PostTransportWork (todo | PostTransportAbort);
        }
@@ -750,23 +746,28 @@ Session::butler_completed_transport_work ()
                } else {
                        process_function = &Session::process_with_events;
                }
+               ptw = PostTransportWork (ptw & ~PostTransportAudition);
+               set_post_transport_work (ptw);
        }
 
        if (ptw & PostTransportLocate) {
                post_locate ();
+               ptw = PostTransportWork (ptw & ~PostTransportLocate);
+               set_post_transport_work (ptw);
                TFSM_EVENT (TransportFSM::LocateDone);
        }
 
        if (ptw & PostTransportAdjustPlaybackBuffering) {
                /* we blocked output while this happened */
                DiskReader::dec_no_disk_output ();
+               ptw = PostTransportWork (ptw & ~PostTransportAdjustPlaybackBuffering);
+               set_post_transport_work (ptw);
        }
 
+       ptw = PostTransportWork (ptw & ~(PostTransportAdjustCaptureBuffering|PostTransportOverWrite));
+       set_post_transport_work (ptw);
+
        set_next_event ();
-       /* XXX is this really safe? shouldn't we just be unsetting the bits that we actually
-          know were handled ?
-       */
-       set_post_transport_work (PostTransportWork (0));
 
        if (_transport_fsm->waiting_for_butler()) {
                TFSM_EVENT (TransportFSM::ButlerDone);
@@ -1424,83 +1425,6 @@ Session::non_realtime_locate ()
        clear_clicks ();
 }
 
-#ifdef USE_TRACKS_CODE_FEATURES
-bool
-Session::select_playhead_priority_target (samplepos_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;
-               }
-       }
-
-       if (jump_to < 0 && (autoreturn & LastLocate)) {
-               jump_to = _last_roll_location;
-       }
-
-       return jump_to >= 0;
-}
-#else
-
 bool
 Session::select_playhead_priority_target (samplepos_t& jump_to)
 {
@@ -1512,8 +1436,6 @@ Session::select_playhead_priority_target (samplepos_t& jump_to)
        return jump_to >= 0;
 }
 
-#endif
-
 void
 Session::follow_playhead_priority ()
 {
@@ -1680,7 +1602,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
        /* do this before seeking, because otherwise the tracks will do the wrong thing in seamless loop mode.
        */
 
-       if (ptw & PostTransportClearSubstate) {
+       if (ptw & (PostTransportClearSubstate|PostTransportStop)) {
                unset_play_range ();
                if (!Config->get_loop_is_mode()) {
                        unset_play_loop ();
@@ -1754,23 +1676,13 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
                SaveSessionRequested (_current_snapshot_name);
        }
 
-       if (ptw & PostTransportStop) {
-               unset_play_range ();
-               if (!Config->get_loop_is_mode()) {
-                       unset_play_loop ();
-               }
-       }
-
        PositionChanged (_transport_sample); /* EMIT SIGNAL */
        DEBUG_TRACE (DEBUG::Transport, string_compose ("send TSC with speed = %1\n", _transport_speed));
        TransportStateChange (); /* EMIT SIGNAL */
        AutomationWatch::instance().transport_stop_automation_watches (_transport_sample);
 
-       /* and start it up again if relevant */
-
-       if ((ptw & PostTransportLocate) && !config.get_external_sync()) {
-               request_transport_speed (1.0);
-       }
+       ptw = PostTransportWork (ptw & ~(PostTransportStop|PostTransportClearSubstate));
+       set_post_transport_work (ptw);
 }
 
 void