Make Session::audible_frame() return a (more) correct answer when the transport has...
authorCarl Hetherington <carl@carlh.net>
Tue, 27 Apr 2010 00:57:46 +0000 (00:57 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 27 Apr 2010 00:57:46 +0000 (00:57 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6999 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor.cc
libs/ardour/ardour/session.h
libs/ardour/session.cc
libs/ardour/session_state.cc
libs/ardour/session_transport.cc

index 9a3a94bf8d210cbfb475522129ee3d28894b71bd..b4e952970b2c4d53595b71d8539223ff302ae5cf 100644 (file)
@@ -5175,6 +5175,7 @@ Editor::super_rapid_screen_update ()
         * 1.  we don't update things when there's a pending locate request, otherwise
         *     when the editor requests a locate there is a chance that this method
         *     will move the playhead before the locate request is processed, causing
+        *     a visual glitch.
         * 2.  if we're not rolling, there's nothing to do here (locates are handled elsewhere).
         * 3.  if we're still at the same frame that we were last time, there's nothing to do.
         */
index e2f3ff1625ab1007e47baeac77d136b9ca049588..8f0a2504ebccd4042e948bd3916ec3c26f1df531 100644 (file)
@@ -987,6 +987,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        int      load_state (std::string snapshot_name);
 
        nframes_t _last_roll_location;
+       nframes_t _last_roll_or_reversal_location;
        nframes_t _last_record_location;
 
        bool              pending_locate_roll;
index 56e4660125a1606b44102da5823226c6b14224f6..4ac6f9ebbc5ed965a3dad9149987db5d5ab6c20e 100644 (file)
@@ -1104,17 +1104,20 @@ Session::audible_frame () const
 
                /* MOVING */
 
-               /* check to see if we have passed the first guaranteed
+               /* Check to see if we have passed the first guaranteed
                   audible frame past our last start position. if not,
                   return that last start point because in terms
                   of audible frames, we have not moved yet.
+
+                  `Start position' in this context means the time we last
+                  either started or changed transport direction.
                */
 
                if (_transport_speed > 0.0f) {
 
                        if (!play_loop || !have_looped) {
-                               if (tf < _last_roll_location + offset) {
-                                       return _last_roll_location;
+                               if (tf < _last_roll_or_reversal_location + offset) {
+                                       return _last_roll_or_reversal_location;
                                }
                        }
 
@@ -1126,8 +1129,8 @@ Session::audible_frame () const
 
                        /* XXX wot? no backward looping? */
 
-                       if (tf > _last_roll_location - offset) {
-                               return _last_roll_location;
+                       if (tf > _last_roll_or_reversal_location - offset) {
+                               return _last_roll_or_reversal_location;
                        } else {
                                /* backwards */
                                ret += offset;
index 82b5d3a249dd4c72dc2b97b07fd4872ab89cc887..ae2eda81d48b8be5630d90ad18ad6a687267ace9 100644 (file)
@@ -184,6 +184,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        play_loop = false;
        have_looped = false;
        _last_roll_location = 0;
+       _last_roll_or_reversal_location = 0;
        _last_record_location = 0;
        pending_locate_frame = 0;
        pending_locate_roll = false;
index aab27fe68b6435d6b2755867fed9d4c3166f118f..6d7d3b4521c9abdea1c1d1018e8d685081b53685 100644 (file)
@@ -1012,6 +1012,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state)
 
                if ((_transport_speed && speed * _transport_speed < 0.0) || (_last_transport_speed * speed < 0.0) || (_last_transport_speed == 0.0f && speed < 0.0f)) {
                        todo = PostTransportWork (todo | PostTransportReverse);
+                       _last_roll_or_reversal_location = _transport_frame;
                }
 
                _last_transport_speed = _transport_speed;
@@ -1097,6 +1098,8 @@ void
 Session::start_transport ()
 {
        _last_roll_location = _transport_frame;
+       _last_roll_or_reversal_location = _transport_frame;
+       
        have_looped = false;
 
        /* if record status is Enabled, move it to Recording. if its