Fix auto-return, hopefully not at the expense of anything else.
authorCarl Hetherington <carl@carlh.net>
Mon, 2 Feb 2009 22:35:50 +0000 (22:35 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 2 Feb 2009 22:35:50 +0000 (22:35 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@4482 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_mixer.cc
libs/ardour/ardour/session.h
libs/ardour/session.cc
libs/ardour/session_events.cc
libs/ardour/session_process.cc
libs/ardour/session_state.cc
libs/ardour/session_transport.cc

index f26e5b130d88a0b9d40baffa4f4954ab0674b351..618d59455ef87e89803a63c30481407c604ecd0c 100644 (file)
@@ -234,9 +234,7 @@ Editor::update_current_screen ()
 {
        if (session && session->engine().running()) {
 
-               nframes64_t frame;
-
-               frame = session->audible_frame();
+               nframes64_t const frame = session->audible_frame();
 
                if (_dragging_playhead) {
                        goto almost_done;
index 60e6aa724e300feea3dd0fb8fddb2e3605035cda..e1db163300ccae87f173f7995307419dc44810f8 100644 (file)
@@ -1024,7 +1024,6 @@ class Session : public PBD::StatefulDestructible
        bool                     auto_play_legal;
        nframes_t               _last_slave_transport_frame;
        nframes_t                maximum_output_latency;
-       nframes_t                last_stop_frame;
        volatile nframes64_t    _requested_return_frame;
        BufferSet*              _scratch_buffers;
        BufferSet*              _silent_buffers;
index ed5ff668aad41d122f9584ac59f258d38b38e13f..77b0d2bf2b63160c32c672561cfddaa1c781f3e0 100644 (file)
@@ -1209,10 +1209,6 @@ Session::audible_frame () const
        nframes_t offset;
        nframes_t tf;
 
-       if (_transport_speed == 0.0f && non_realtime_work_pending()) {
-               return last_stop_frame;
-       }
-
        /* the first of these two possible settings for "offset"
           mean that the audible frame is stationary until
           audio emerges from the latency compensation
@@ -1259,7 +1255,6 @@ Session::audible_frame () const
                        if (!play_loop || !have_looped) {
                                if (tf < _last_roll_location + offset) {
                                        return _last_roll_location;
-                                       
                                }
                        } 
                        
index 5fc8cd75353561f3e90aa002304f21fc8d1eee96..22b05fe46d5e2e5d7acac28166863d14fe087384 100644 (file)
@@ -355,7 +355,6 @@ Session::process_event (Event* ev)
        case Event::LocateRollLocate:
                // locate is handled by ::request_roll_at_and_return()
                _requested_return_frame = ev->target_frame;
-               cerr << "Set RRF " << ev->target_frame << endl;
                request_locate (ev->target2_frame, true);
                break;
 
index dfb070b61c63a1ee459a7fc2e7ab950ec792b474..87c9f77073d9dcfe2549e834cf26b1b33125d032 100644 (file)
@@ -733,10 +733,6 @@ Session::track_slave_state(
                             << " tf = " << _transport_frame << endl;
          #endif
                        
-                       if (Config->get_slave_source() == JACK) {
-                               last_stop_frame = _transport_frame;
-                       }
-
                        stop_transport();
                }
 
index 0f1d9720351a3c21f5f24aa1f3ce21fd2a115d1f..4184300e78d20cfa74dd4ad2241f7ac65cab0a53 100644 (file)
@@ -161,7 +161,6 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        auto_play_legal = false;
        transport_sub_state = 0;
        _transport_frame = 0;
-       last_stop_frame = 0;
        end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd)));
        start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
        _end_location_is_free = true;
index 5b2c351b883db6924065242a3f2689b289e484e2..86c285e60091f206363d9092fc2e3e1ae91f4e7d 100644 (file)
@@ -390,7 +390,10 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
                update_latency_compensation (true, abort);
        }
 
-       if ((Config->get_slave_source() == None && Config->get_auto_return()) ||
+       bool const auto_return_enabled =
+               (Config->get_slave_source() == None && Config->get_auto_return());
+       
+       if (auto_return_enabled ||
            (post_transport_work & PostTransportLocate) ||
            (_requested_return_frame >= 0) ||
            synced_to_jack()) {
@@ -399,9 +402,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
                        flush_all_inserts ();
                }
 
-               if (((Config->get_slave_source() == None && Config->get_auto_return()) ||
-                    synced_to_jack() ||
-                    _requested_return_frame >= 0) &&
+               if ((auto_return_enabled || synced_to_jack() || _requested_return_frame >= 0) &&
                    !(post_transport_work & PostTransportLocate)) {
 
                        bool do_locate = false;
@@ -411,8 +412,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
                                _requested_return_frame = -1;
                                do_locate = true;
                        } else {
-                               _transport_frame = last_stop_frame;
-                               _requested_return_frame = -1;
+                               _transport_frame = _last_roll_location;
                        }
 
                        if (synced_to_jack() && !play_loop) {
@@ -444,13 +444,6 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
        }
 #endif
 
-        if (_requested_return_frame < 0) {
-               last_stop_frame = _transport_frame;
-       } else {
-               last_stop_frame = _requested_return_frame;
-               _requested_return_frame = -1;
-       }
-
         have_looped = false; 
 
         send_full_time_code (0);
@@ -896,7 +889,6 @@ Session::set_transport_speed (double speed, bool abort)
 
                if ((_transport_speed && speed * _transport_speed < 0.0) || (_last_transport_speed * speed < 0.0) || (_last_transport_speed == 0.0f && speed < 0.0f)) {
                        post_transport_work = PostTransportWork (post_transport_work | PostTransportReverse);
-                       last_stop_frame = _transport_frame;
                }
 
                _last_transport_speed = _transport_speed;