| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,41 @@ |
| 1 |
+#ifndef TWOSF2WAV_INTERPOLATOR_H |
|
| 2 |
+#define TWOSF2WAV_INTERPOLATOR_H |
|
| 3 |
+ |
|
| 4 |
+#include <vector> |
|
| 5 |
+#include <cstdint> |
|
| 6 |
+ |
|
| 7 |
+class IInterpolator |
|
| 8 |
+{
|
|
| 9 |
+public: |
|
| 10 |
+ virtual ~IInterpolator() {}
|
|
| 11 |
+ |
|
| 12 |
+ virtual int32_t interpolate(const std::vector<int32_t>& data, double time) const = 0; |
|
| 13 |
+ |
|
| 14 |
+ static IInterpolator* allInterpolators[4]; |
|
| 15 |
+}; |
|
| 16 |
+ |
|
| 17 |
+class LinearInterpolator : public IInterpolator |
|
| 18 |
+{
|
|
| 19 |
+public: |
|
| 20 |
+ virtual int32_t interpolate(const std::vector<int32_t>& data, double time) const; |
|
| 21 |
+}; |
|
| 22 |
+ |
|
| 23 |
+class CosineInterpolator : public IInterpolator |
|
| 24 |
+{
|
|
| 25 |
+public: |
|
| 26 |
+ CosineInterpolator(); |
|
| 27 |
+ |
|
| 28 |
+ virtual int32_t interpolate(const std::vector<int32_t>& data, double time) const; |
|
| 29 |
+ |
|
| 30 |
+private: |
|
| 31 |
+ double lut[8192]; |
|
| 32 |
+}; |
|
| 33 |
+ |
|
| 34 |
+class SharpIInterpolator : public IInterpolator |
|
| 35 |
+{
|
|
| 36 |
+public: |
|
| 37 |
+ virtual int32_t interpolate(const std::vector<int32_t>& data, double time) const; |
|
| 38 |
+}; |
|
| 39 |
+ |
|
| 40 |
+ |
|
| 41 |
+#endif |