fix required-sample count for cubic interpolation.
authorRobin Gareus <robin@gareus.org>
Wed, 7 Nov 2012 03:17:55 +0000 (03:17 +0000)
committerRobin Gareus <robin@gareus.org>
Wed, 7 Nov 2012 03:17:55 +0000 (03:17 +0000)
I have not proved if the iterative process in
CubicInterpolation::interpolate() is identical to
(nframes * fabs(_actual_speed)), however ceil()
of it is empirically always larger.
Also, the cubic interpolation needs +2 samples.

Ardour3: Too close to call :)

git-svn-id: svn://localhost/ardour2/branches/3.0@13392 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audio_diskstream.cc

index 3345a00b423deedbb7217a9047c350c03db53f11..2d2d3d252fa343b3ab88db388b17e1fa1c2e9fc3 100644 (file)
@@ -578,7 +578,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, framecn
                /* no varispeed playback if we're recording, because the output .... TBD */
 
                if (rec_nframes == 0 && _actual_speed != 1.0f) {
-                       necessary_samples = (framecnt_t) floor ((nframes * fabs (_actual_speed))) + 1;
+                       necessary_samples = (framecnt_t) ceil ((nframes * fabs (_actual_speed))) + 2;
                } else {
                        necessary_samples = nframes;
                }