From 762b02bc9586b06665564b8170bb9b274c39df94 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 2 Feb 2009 22:35:50 +0000 Subject: [PATCH] Fix auto-return, hopefully not at the expense of anything else. git-svn-id: svn://localhost/ardour2/branches/3.0@4482 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_mixer.cc | 4 +--- libs/ardour/ardour/session.h | 1 - libs/ardour/session.cc | 5 ----- libs/ardour/session_events.cc | 1 - libs/ardour/session_process.cc | 4 ---- libs/ardour/session_state.cc | 1 - libs/ardour/session_transport.cc | 20 ++++++-------------- 7 files changed, 7 insertions(+), 29 deletions(-) diff --git a/gtk2_ardour/editor_mixer.cc b/gtk2_ardour/editor_mixer.cc index f26e5b130d..618d59455e 100644 --- a/gtk2_ardour/editor_mixer.cc +++ b/gtk2_ardour/editor_mixer.cc @@ -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; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 60e6aa724e..e1db163300 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -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; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index ed5ff668aa..77b0d2bf2b 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -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; - } } diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc index 5fc8cd7535..22b05fe46d 100644 --- a/libs/ardour/session_events.cc +++ b/libs/ardour/session_events.cc @@ -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; diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index dfb070b61c..87c9f77073 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -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(); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 0f1d972035..4184300e78 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -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; diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 5b2c351b88..86c285e600 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -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;