fix up some jerkiness/retrograde motion of playhead

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3988 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-10-20 19:44:43 +00:00
parent 80b6af8b6b
commit a02c4dadf1
5 changed files with 44 additions and 8 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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 ();

View File

@ -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