diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-21 15:03:50 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-21 15:03:50 +0000 |
commit | 6405e51c856c9094507b7da20511b907bc41f9f7 (patch) | |
tree | dd1e2bd5587bf79cceafd2e3fec0865d0cad9b31 /libs/ardour/session.cc | |
parent | 8e095d439f5b527eeadd9588b725733e64a57427 (diff) |
improved (?) Session::audible_frame()
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3990 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 67 |
1 files changed, 29 insertions, 38 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 0a58a7da25..a6a322739e 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1377,6 +1377,10 @@ Session::audible_frame () const nframes_t ret; nframes_t offset; nframes_t tf; + + if (_transport_speed == 0.0f) { + return last_stop_frame; + } /* the first of these two possible settings for "offset" mean that the audible frame is stationary until @@ -1407,56 +1411,43 @@ Session::audible_frame () const tf = _transport_frame; } - if (_transport_speed == 0) { - ret = tf; - goto block_retrograde; - } - - if (tf < offset) { - ret = 0; - goto block_retrograde; - } - ret = tf; if (!non_realtime_work_pending()) { /* MOVING */ - /* take latency into account */ - - if (_transport_speed > 0.0) { - /* forwards */ - ret -= offset; - } else { - /* backwards */ - ret += offset; - } + /* check to see if we have passed the first guaranteed + audible frame past our last stopping position. if not, + the return that last stopping point because in terms + of audible frames, we have not moved yet. + */ - } + if (_transport_speed > 0.0f) { - /* 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. - */ + if (!play_loop || !have_looped) { + if (tf < last_stop_frame + offset) { + return last_stop_frame; + + } + } + - block_retrograde: - if ((af_last_transport_speed >= 0.0) == (_transport_speed >= 0.0)) { + /* forwards */ + ret -= offset; - if (_transport_speed > 0.0) { - if (ret < af_last_frame) { - ret = af_last_frame; - } + } else if (_transport_speed < 0.0f) { - } else if (_transport_speed < 0.0) { - if (ret > af_last_frame) { - ret = af_last_frame; + /* XXX wot? no backward looping? */ + + if (tf > last_stop_frame - offset) { + return last_stop_frame; + } else { + /* backwards */ + ret += offset; } - } - } - - af_last_frame = ret; - af_last_transport_speed = _transport_speed; + } + } return ret; } |