New test.
[ardour.git] / libs / ardour / interpolation.cc
index 1393d8aae81e659c1e4c87b9954307e44c5ce8b3..20ab584885e7f19dd6bd348c2648b5d429c08c1b 100644 (file)
@@ -6,11 +6,11 @@
 using namespace ARDOUR;
 
 
-nframes_t
-LinearInterpolation::interpolate (int channel, nframes_t nframes, Sample *input, Sample *output)
+framecnt_t
+LinearInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input, Sample *output)
 {
        // index in the input buffers
-       nframes_t   i = 0;
+       framecnt_t   i = 0;
 
        double acceleration;
        double distance = 0.0;
@@ -22,7 +22,7 @@ LinearInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
        }
 
        distance = phase[channel];
-       for (nframes_t outsample = 0; outsample < nframes; ++outsample) {
+       for (framecnt_t outsample = 0; outsample < nframes; ++outsample) {
                i = floor(distance);
                Sample fractional_phase_part = distance - i;
                if (fractional_phase_part >= 1.0) {
@@ -45,11 +45,11 @@ LinearInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
        return i;
 }
 
-nframes_t
-CubicInterpolation::interpolate (int channel, nframes_t nframes, Sample *input, Sample *output)
+framecnt_t
+CubicInterpolation::interpolate (int channel, framecnt_t nframes, Sample *input, Sample *output)
 {
     // index in the input buffers
-    nframes_t   i = 0;
+    framecnt_t   i = 0;
 
     double acceleration;
     double distance = 0.0;
@@ -57,7 +57,7 @@ CubicInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
     if (_speed != _target_speed) {
         acceleration = _target_speed - _speed;
     } else {
-        acceleration = 0.0;
+           acceleration = 0.0;
     }
 
     distance = phase[channel];
@@ -73,13 +73,13 @@ CubicInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
     }
 
     /* keep this condition out of the inner loop */
-    
+
     if (input && output) {
 
            Sample inm1;
-           
+
            if (floor (distance) == 0.0) {
-                   /* best guess for the fake point we have to add to be able to interpolate at i == 0: 
+                   /* best guess for the fake point we have to add to be able to interpolate at i == 0:
                       .... maintain slope of first actual segment ...
                    */
                    inm1 = input[i] - (input[i+1] - input[i]);
@@ -87,7 +87,7 @@ CubicInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
                    inm1 = input[i-1];
            }
 
-           for (nframes_t outsample = 0; outsample < nframes; ++outsample) {
+           for (framecnt_t outsample = 0; outsample < nframes; ++outsample) {
 
                    float f = floor (distance);
                    float fractional_phase_part = distance - f;
@@ -106,7 +106,7 @@ CubicInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
                    if (fractional_phase_part >= 1.0) {
                            fractional_phase_part -= 1.0;
                            ++i;
-                   } 
+                   }
 
                    // Cubically interpolate into the output buffer: keep this inlined for speed and rely on compiler
                    // optimization to take care of the rest
@@ -124,7 +124,7 @@ CubicInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
 
            /* not sure that this is ever utilized - it implies that one of the input/output buffers is missing */
 
-           for (nframes_t outsample = 0; outsample < nframes; ++outsample) {
+           for (framecnt_t outsample = 0; outsample < nframes; ++outsample) {
                    distance += _speed + acceleration;
            }
     }