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(const ResampleHQ&) = delete;
25 ResampleHQ& operator=(const ResampleHQ&) = delete;
27 ~ResampleHQ() override;
28
29 bool generateOutputImpl(float* dataOut, size_t num,
30 EmuTime::param time) override;
31
32private:
33 void calcOutput(float pos, float* output);
34 void prepareData(unsigned emuNum);
35
36private:
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} // namespace openmsx
49
50#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
ResampleHQ & operator=(ResampleHQ &&)=delete
static constexpr size_t HALF_TAB_LEN
Definition ResampleHQ.hh:19
ResampleHQ(ResampleHQ &&)=delete
This file implemented 3 utility functions:
Definition Autofire.cc:11