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 "DynamicClock.hh"
6 #include <cstdint>
7 #include <vector>
8 
9 namespace openmsx {
10 
11 class ResampledSoundDevice;
12 
13 template <unsigned CHANNELS>
14 class ResampleHQ final : public ResampleAlgo
15 {
16 public:
18  const DynamicClock& hostClock, unsigned emuSampleRate);
19  ~ResampleHQ() override;
20 
21  bool generateOutput(float* dataOut, unsigned num,
22  EmuTime::param time) override;
23 
24 private:
25  void calcOutput(float pos, float* output);
26  void prepareData(unsigned emuNum);
27 
28  ResampledSoundDevice& input;
29  const DynamicClock& hostClock;
30  DynamicClock emuClock;
31 
32  const float ratio;
33  unsigned bufStart;
34  unsigned bufEnd;
35  unsigned nonzeroSamples;
36  unsigned filterLen;
37  std::vector<float> buffer;
38  float* table;
39  int16_t* permute;
40 };
41 
42 } // namespace openmsx
43 
44 #endif
ResampleHQ(ResampledSoundDevice &input, const DynamicClock &hostClock, unsigned emuSampleRate)
Definition: ResampleHQ.cc:372
~ResampleHQ() override
Definition: ResampleHQ.cc:392
Represents a clock with a variable frequency.
Definition: DynamicClock.hh:15
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
bool generateOutput(float *dataOut, unsigned num, EmuTime::param time) override
Definition: ResampleHQ.cc:643