summaryrefslogtreecommitdiff
path: root/libs/ardour/session_process.cc
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2009-01-10 08:42:07 +0000
committerHans Baier <hansfbaier@googlemail.com>2009-01-10 08:42:07 +0000
commitb7715419f2ae85af70a0d78722798a5b0ea16263 (patch)
tree44b193e0870a7693dc5bd76ad79e0c6c178851c2 /libs/ardour/session_process.cc
parentbfbae251be8b67b33ad1c95b56e30da0cb537ec5 (diff)
* wrong calculation of frames_moved in Session::process_*, resulting in drift against any Slaves when transport speed != 1.0
git-svn-id: svn://localhost/ardour2/branches/3.0@4397 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_process.cc')
-rw-r--r--libs/ardour/session_process.cc33
1 files changed, 25 insertions, 8 deletions
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 6247a4d654..dfb070b61c 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -271,11 +271,11 @@ void
Session::process_with_events (nframes_t nframes)
{
Event* ev;
- nframes_t this_nframes;
- nframes_t end_frame;
- nframes_t offset;
- bool session_needs_butler = false;
- nframes_t stop_limit;
+ nframes_t this_nframes;
+ nframes_t end_frame;
+ nframes_t offset;
+ bool session_needs_butler = false;
+ nframes_t stop_limit;
long frames_moved;
/* make sure the auditioner is silent */
@@ -319,7 +319,17 @@ Session::process_with_events (nframes_t nframes)
return;
}
- end_frame = _transport_frame + (nframes_t)abs(floor(nframes * _transport_speed));
+ /// TODO: Figure out what happens to phi and phase, if transport speed momentarily becomes
+ /// 1.0 eg. during the adjustments of a slave. If that is a bug, then AudioDiskstream::process
+ /// is very likely broken too
+ if (_transport_speed == 1.0) {
+ frames_moved = (long) nframes;
+ } else {
+ frames_moved = (long) AudioDiskstream::
+ calculate_varispeed_playback_distance(nframes, phase, phi, target_phi);
+ }
+
+ end_frame = _transport_frame + (nframes_t)frames_moved;
{
Event* this_event;
@@ -372,7 +382,6 @@ Session::process_with_events (nframes_t nframes)
while (nframes) {
this_nframes = nframes; /* real (jack) time relative */
- frames_moved = (long) floor (_transport_speed * nframes); /* transport relative */
/* running an event, position transport precisely to its time */
if (this_event && this_event->action_frame <= end_frame && this_event->action_frame >= _transport_frame) {
@@ -836,7 +845,15 @@ Session::process_without_events (nframes_t nframes)
prepare_diskstreams ();
- frames_moved = (long) floor (_transport_speed * nframes);
+ /// TODO: Figure out what happens to phi and phase, if transport speed momentarily becomes
+ /// 1.0 eg. during the adjustments of a slave. If that is a bug, then AudioDiskstream::process
+ /// is very likely broken too
+ if (_transport_speed == 1.0) {
+ frames_moved = (long) nframes;
+ } else {
+ frames_moved = (long) AudioDiskstream::
+ calculate_varispeed_playback_distance(nframes, phase, phi, target_phi);
+ }
if (process_routes (nframes, offset)) {
no_roll (nframes, offset);