summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-04-27 00:57:46 +0000
committerCarl Hetherington <carl@carlh.net>2010-04-27 00:57:46 +0000
commit581376e0ed7d8934b384766ee4500dd6abeb755d (patch)
tree7c420c721e6e93fb9722e3ce72698f1981b1a3ca /libs
parent83b30a6d0609f1778f8ec8a25eac298714a0a4f2 (diff)
Make Session::audible_frame() return a (more) correct answer when the transport has changed direction since it last started rolling. Fixes some playhead anomolies when reversing the transport.
git-svn-id: svn://localhost/ardour2/branches/3.0@6999 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/session.cc13
-rw-r--r--libs/ardour/session_state.cc1
-rw-r--r--libs/ardour/session_transport.cc3
4 files changed, 13 insertions, 5 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index e2f3ff1625..8f0a2504eb 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -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;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 56e4660125..4ac6f9ebbc 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -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;
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 82b5d3a249..ae2eda81d4 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -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;
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index aab27fe68b..6d7d3b4521 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -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