| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,38 @@ |
| 1 |
+#ifndef TWOSF2WAV_SAMPLEDATA_H |
|
| 2 |
+#define TWOSF2WAV_SAMPLEDATA_H |
|
| 3 |
+ |
|
| 4 |
+#include <vector> |
|
| 5 |
+#include <cstdint> |
|
| 6 |
+class IInterpolator; |
|
| 7 |
+ |
|
| 8 |
+class SampleData : public std::vector<int32_t> |
|
| 9 |
+{
|
|
| 10 |
+public: |
|
| 11 |
+ enum Format {
|
|
| 12 |
+ Pcm8, |
|
| 13 |
+ Pcm16, |
|
| 14 |
+ Adpcm |
|
| 15 |
+ }; |
|
| 16 |
+ |
|
| 17 |
+ SampleData(); |
|
| 18 |
+ SampleData(uint32_t baseAddr, uint16_t loopStart, uint32_t loopLength, Format format); |
|
| 19 |
+ SampleData(const SampleData&) = default; |
|
| 20 |
+ SampleData(SampleData&&) = default; |
|
| 21 |
+ ~SampleData() = default; |
|
| 22 |
+ |
|
| 23 |
+ SampleData& operator=(const SampleData&) = default; |
|
| 24 |
+ SampleData& operator=(SampleData&&) = default; |
|
| 25 |
+ |
|
| 26 |
+ int32_t sampleAt(double time, IInterpolator* interp = nullptr) const; |
|
| 27 |
+ |
|
| 28 |
+ uint32_t baseAddr; |
|
| 29 |
+ uint16_t loopStart; |
|
| 30 |
+ uint32_t loopLength; |
|
| 31 |
+ |
|
| 32 |
+private: |
|
| 33 |
+ void loadPcm8(); |
|
| 34 |
+ void loadPcm16(); |
|
| 35 |
+ void loadAdpcm(); |
|
| 36 |
+}; |
|
| 37 |
+ |
|
| 38 |
+#endif |