diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-20 19:44:43 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-20 19:44:43 +0000 |
commit | a02c4dadf19a4c131f86b3c7d66eccbeb63716e0 (patch) | |
tree | d6397040beb43d7e23a216da49234688720b636d | |
parent | 80b6af8b6b82522ec9c86a66477dcdf460fa517e (diff) |
fix up some jerkiness/retrograde motion of playhead
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3988 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/editor_cursors.cc | 5 | ||||
-rw-r--r-- | libs/ardour/ardour/session.h | 5 | ||||
-rw-r--r-- | libs/ardour/session.cc | 38 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 2 | ||||
-rw-r--r-- | svn_revision.h | 2 |
5 files changed, 44 insertions, 8 deletions
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index 0f5c414408..93743f580e 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -35,10 +35,7 @@ Editor::Cursor::Cursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,ArdourCanv canvas_item (*editor.cursor_group), length(1.0) { - - /* "randomly" initialize coords */ - - points.push_back(Gnome::Art::Point(1.0, 0.0)); + points.push_back(Gnome::Art::Point(-1.0, 0.0)); // first x-coord needs to be a non-normal value points.push_back(Gnome::Art::Point(1.0, 1.0)); canvas_item.property_points() = points; diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 38ed0a5b89..35b8c5489d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1752,6 +1752,11 @@ class Session : public PBD::StatefulDestructible void set_history_depth (uint32_t depth); static bool _disable_all_loaded_plugins; + + /* used in ::audible_frame() */ + + mutable float af_last_transport_speed; + mutable nframes64_t af_last_frame; }; } // namespace ARDOUR diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 4d3cd7b606..0a58a7da25 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1408,11 +1408,13 @@ Session::audible_frame () const } if (_transport_speed == 0) { - return tf; + ret = tf; + goto block_retrograde; } if (tf < offset) { - return 0; + ret = 0; + goto block_retrograde; } ret = tf; @@ -1423,9 +1425,39 @@ Session::audible_frame () const /* take latency into account */ - ret -= offset; + if (_transport_speed > 0.0) { + /* forwards */ + ret -= offset; + } else { + /* backwards */ + ret += offset; + } + } + /* do not allow retrograde motion near startup or a direction change + caused by latency correction. we detect this by the asking if the present + and previously-noted transport speed (and thus direction) are the same. + */ + + block_retrograde: + if ((af_last_transport_speed >= 0.0) == (_transport_speed >= 0.0)) { + + if (_transport_speed > 0.0) { + if (ret < af_last_frame) { + ret = af_last_frame; + } + + } else if (_transport_speed < 0.0) { + if (ret > af_last_frame) { + ret = af_last_frame; + } + } + } + + af_last_frame = ret; + af_last_transport_speed = _transport_speed; + return ret; } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index e1ed93918a..469914c971 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -228,6 +228,8 @@ Session::first_stage_init (string fullpath, string snapshot_name) _smpte_offset = 0; _smpte_offset_negative = true; last_smpte_valid = false; + af_last_transport_speed = 0.0; + af_last_frame = 0.0; sync_time_vars (); diff --git a/svn_revision.h b/svn_revision.h index 22d9301de8..67781c0015 100644 --- a/svn_revision.h +++ b/svn_revision.h @@ -1,4 +1,4 @@ #ifndef __ardour_svn_revision_h__ #define __ardour_svn_revision_h__ -static const char* ardour_svn_revision = "3963"; +static const char* ardour_svn_revision = "3980"; #endif |