fix vari-speed phase (when used for calculation only)
authorRobin Gareus <robin@gareus.org>
Tue, 27 Aug 2013 18:55:15 +0000 (20:55 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 27 Aug 2013 18:55:15 +0000 (20:55 +0200)
and clarify an old comment.

libs/ardour/interpolation.cc

index fccc805cb018917a0848e25f90fdbdb7d2a7f716..bccaa45553484bb0eceb9e82eeb6b578a3b174a4 100644 (file)
@@ -135,17 +135,18 @@ CubicInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input,
                    inm1 = input[i];
            }
 
-    } else {
-
-           /* not sure that this is ever utilized - it implies that one of the input/output buffers is missing */
+           i = floor(distance);
+           phase[channel] = distance - floor(distance);
 
+    } else {
+           /* used to calculate play-distance with acceleration (silent roll)
+            * (use same algorithm as real playback for identical rounding/floor'ing)
+            */
            for (framecnt_t outsample = 0; outsample < nframes; ++outsample) {
                    distance += _speed + acceleration;
            }
+           i = floor(distance);
     }
 
-    i = floor(distance);
-    phase[channel] = distance - floor(distance);
-
     return i;
 }