-
-
-/**
- * @class SplineInterpolation
- *
- * @brief interpolates using cubic spline interpolation over an input period
- *
- * Splines are piecewise cubic functions between each samples,
- * where the cubic polynomials' values, first and second derivatives are equal
- * on each sample point.
- *
- * The interpolation polynomial in the i-th interval then has the form
- * p_i(x) = a3 (x - i)^3 + a2 (x - i)^2 + a1 (x - i) + a0
- * = ((a3 * (x - i) + a2) * (x - i) + a1) * (x - i) + a0
- * where
- * a3 = (M[i+1] - M[i]) / 6
- * a2 = M[i] / 2
- * a1 = y[i+1] - y[i] - M[i+1]/6 - M[i]/3
- * a0 = y[i]
- *
- * The M's are calculated recursively:
- * M[i+2] = 6.0 * (y[i] - 2y[i+1] + y[i+2]) - 4M[i+1] - M[i]
- *
- */
-class SplineInterpolation : public Interpolation {
- protected:
- double M[2];
-
- public:
- void reset ();
- SplineInterpolation();
- nframes_t interpolate (int channel, nframes_t nframes, Sample* input, Sample* output);
-};
-
-class LibSamplerateInterpolation : public Interpolation {
- protected:
- std::vector<SRC_STATE*> state;
- std::vector<SRC_DATA*> data;
-
- int error;
-
- void reset_state ();
-
- public:
- LibSamplerateInterpolation ();
- ~LibSamplerateInterpolation ();
-
- void set_speed (double new_speed);
- void set_target_speed (double new_speed) {}
- double speed () const { return _speed; }
-
- void add_channel_to (int input_buffer_size, int output_buffer_size);
- void remove_channel_from ();
-
- nframes_t interpolate (int channel, nframes_t nframes, Sample* input, Sample* output);
- void reset() { reset_state (); }
-};