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