openMSX
ResampleBlip.hh
Go to the documentation of this file.
1 #ifndef RESAMPLEBLIP_HH
2 #define RESAMPLEBLIP_HH
3 
4 #include "ResampleAlgo.hh"
5 #include "BlipBuffer.hh"
6 #include "DynamicClock.hh"
7 
8 namespace openmsx {
9 
10 class ResampledSoundDevice;
11 
12 template <unsigned CHANNELS>
13 class ResampleBlip final : public ResampleAlgo
14 {
15 public:
16  ResampleBlip(ResampledSoundDevice& input,
17  const DynamicClock& hostClock, unsigned emuSampleRate);
18 
19  bool generateOutput(float* dataOut, unsigned num,
20  EmuTime::param time) override;
21 
22 private:
23  BlipBuffer blip[CHANNELS];
24  ResampledSoundDevice& input;
25  const DynamicClock& hostClock; // time of the last host-sample,
26  // ticks once per host sample
27  DynamicClock emuClock; // time of the last emu-sample,
28  // ticks once per emu-sample
29  using FP = FixedPoint<16>;
30  const FP step;
31  float lastInput[CHANNELS];
32 };
33 
34 } // namespace openmsx
35 
36 #endif
bool getEnum() const noexcept
Definition: EnumSetting.hh:96
bool generateOutput(float *dataOut, unsigned num, EmuTime::param time) override
Definition: ResampleBlip.cc:23
A fixed point number, implemented by a 32-bit signed integer.
Definition: FixedPoint.hh:15
Represents a clock with a variable frequency.
Definition: DynamicClock.hh:15
ResampleBlip(ResampledSoundDevice &input, const DynamicClock &hostClock, unsigned emuSampleRate)
Definition: ResampleBlip.cc:11