| e8555c89 Andy McCall |
1 |
#ifndef RESAMPLEHQ_HH |
| 2 |
#define RESAMPLEHQ_HH |
| 3 |
|
| 4 |
#include "ResampleAlgo.hh" |
| 5 |
#include <cstdint> |
| 6 |
#include <span> |
| 7 |
#include <vector> |
| 8 |
|
| 9 |
namespace openmsx { |
| 10 |
|
| 11 |
class DynamicClock; |
| 12 |
class ResampledSoundDevice; |
| 13 |
|
| 14 |
template<unsigned CHANNELS> |
| 15 |
class ResampleHQ final : public ResampleAlgo |
| 16 |
{ |
| 17 |
public: |
| 18 |
static constexpr size_t TAB_LEN = 4096; |
| 19 |
static constexpr size_t HALF_TAB_LEN = TAB_LEN / 2; |
| 20 |
|
| 21 |
public: |
| 22 |
ResampleHQ(ResampledSoundDevice& input, const DynamicClock& hostClock); |
| 23 |
ResampleHQ(const ResampleHQ&) = delete; |
| 24 |
ResampleHQ(ResampleHQ&&) = delete; |
| 25 |
ResampleHQ& operator=(const ResampleHQ&) = delete; |
| 26 |
ResampleHQ& operator=(ResampleHQ&&) = delete; |
| 27 |
~ResampleHQ() override; |
| 28 |
|
| 29 |
bool generateOutputImpl(float* dataOut, size_t num, |
| 30 |
EmuTime time) override; |
| 31 |
|
| 32 |
private: |
| 33 |
void calcOutput(float pos, float* output); |
| 34 |
void prepareData(unsigned emuNum); |
| 35 |
|
| 36 |
private: |
| 37 |
const DynamicClock& hostClock; |
| 38 |
const float ratio; |
| 39 |
unsigned bufStart; |
| 40 |
unsigned bufEnd; |
| 41 |
unsigned nonzeroSamples = 0; |
| 42 |
unsigned filterLen; |
| 43 |
std::vector<float> buffer; |
| 44 |
float* table; |
| 45 |
std::span<const int16_t, HALF_TAB_LEN> permute; |
| 46 |
}; |
| 47 |
|
| 48 |
} |
| 49 |
|
| 50 |
#endif |