diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2009-07-23 16:55:38 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2009-07-23 16:55:38 +0000 |
commit | 19d89fc1dc44a5edbdd447bddb318c3f4b22633d (patch) | |
tree | 48a6e057540182ea7c2ff600507580be6afd9619 /libs/ardour/ardour/interpolation.h | |
parent | c948806811e106cebc20b982aeebd8e43a934652 (diff) |
interpolation.cc/h: Fix crash bug and introduce add simple cubic interpolation
git-svn-id: svn://localhost/ardour2/branches/3.0@5418 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ardour/interpolation.h')
-rw-r--r-- | libs/ardour/ardour/interpolation.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/ardour/ardour/interpolation.h b/libs/ardour/ardour/interpolation.h index f417c8c46e..1ba2b5a11e 100644 --- a/libs/ardour/ardour/interpolation.h +++ b/libs/ardour/ardour/interpolation.h @@ -32,7 +32,7 @@ class Interpolation { void remove_channel_from () { phase.pop_back (); } void reset () { - for (size_t i = 0; i <= phase.size(); i++) { + for (size_t i = 0; i < phase.size(); i++) { phase[i] = 0.0; } } @@ -89,6 +89,21 @@ class LinearInterpolation : public Interpolation { public: nframes_t interpolate (int channel, nframes_t nframes, Sample* input, Sample* output); }; + +class CubicInterpolation : public Interpolation { + protected: + // shamelessly ripped from Steve Harris' swh-plugins + static inline float cube_interp(const float fr, const float inm1, const float + in, const float inp1, const float inp2) + { + return in + 0.5f * fr * (inp1 - inm1 + + fr * (4.0f * inp1 + 2.0f * inm1 - 5.0f * in - inp2 + + fr * (3.0f * (in - inp1) - inm1 + inp2))); + } + + public: + nframes_t interpolate (int channel, nframes_t nframes, Sample* input, Sample* output); +}; /** |