Interpolation -> LibSamplerateInterpolation, keep state per channel
[ardour.git] / libs / ardour / ardour / interpolation.h
1 #include <math.h>
2 #include <samplerate.h>
3
4 #include "ardour/types.h"
5
6 #ifndef __interpolation_h__
7 #define __interpolation_h__
8
9 namespace ARDOUR {
10
11 class LibSamplerateInterpolation {
12 protected:
13         double   _speed;
14         
15         std::vector<SRC_STATE*>  state;
16         std::vector<SRC_DATA*>   data;
17         
18         int        error;
19         
20         void reset_state ();
21         
22 public:
23         LibSamplerateInterpolation ();
24         ~LibSamplerateInterpolation ();
25     
26         void   set_speed (double new_speed);
27         void   set_target_speed (double new_speed)   {}
28         double speed ()                        const { return _speed;      }
29         
30         void add_channel_to (int input_buffer_size, int output_buffer_size);
31         void remove_channel_from (); 
32  
33         nframes_t interpolate (int channel, nframes_t nframes, Sample* input, Sample* output);
34 };
35
36 } // namespace ARDOUR
37
38 #endif