openMSX
ResampleLQ.hh
Go to the documentation of this file.
1 #ifndef RESAMPLELQ_HH
2 #define RESAMPLELQ_HH
3 
4 #include "ResampleAlgo.hh"
5 #include "DynamicClock.hh"
6 #include "FixedPoint.hh"
7 #include <memory>
8 
9 namespace openmsx {
10 
11 class ResampledSoundDevice;
12 
13 template<unsigned CHANNELS>
14 class ResampleLQ : public ResampleAlgo
15 {
16 public:
17  static std::unique_ptr<ResampleLQ<CHANNELS>> create(
19 
20 protected:
22  [[nodiscard]] bool fetchData(EmuTime::param time, unsigned& valid);
23 
24 protected:
26  using FP = FixedPoint<14>;
27  const FP step;
28  float lastInput[2 * CHANNELS];
29 };
30 
31 template<unsigned CHANNELS>
32 class ResampleLQDown final : public ResampleLQ<CHANNELS>
33 {
34 public:
36 private:
37  bool generateOutputImpl(float* dataOut, unsigned num,
38  EmuTime::param time) override;
39  using FP = typename ResampleLQ<CHANNELS>::FP;
40 };
41 
42 template<unsigned CHANNELS>
43 class ResampleLQUp final : public ResampleLQ<CHANNELS>
44 {
45 public:
47 private:
48  bool generateOutputImpl(float* dataOut, unsigned num,
49  EmuTime::param time) override;
50  using FP = typename ResampleLQ<CHANNELS>::FP;
51 };
52 
53 } // namespace openmsx
54 
55 #endif
constexpr unsigned CHANNELS
Definition: YM2413Test.cc:20
Represents a clock with a variable frequency.
Definition: DynamicClock.hh:17
A fixed point number, implemented by a 32-bit signed integer.
Definition: FixedPoint.hh:15
ResampledSoundDevice & input
Definition: ResampleAlgo.hh:32
ResampleLQDown(ResampledSoundDevice &input, const DynamicClock &hostClock)
Definition: ResampleLQ.cc:138
ResampleLQUp(ResampledSoundDevice &input, const DynamicClock &hostClock)
Definition: ResampleLQ.cc:98
ResampleLQ(ResampledSoundDevice &input, const DynamicClock &hostClock)
Definition: ResampleLQ.cc:34
bool fetchData(EmuTime::param time, unsigned &valid)
Definition: ResampleLQ.cc:56
float lastInput[2 *CHANNELS]
Definition: ResampleLQ.hh:28
static std::unique_ptr< ResampleLQ< CHANNELS > > create(ResampledSoundDevice &input, const DynamicClock &hostClock)
Definition: ResampleLQ.cc:21
const DynamicClock & hostClock
Definition: ResampleLQ.hh:25
This file implemented 3 utility functions:
Definition: Autofire.cc:5