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:
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
BlipBuffer.hh
CHANNELS
constexpr unsigned CHANNELS
Definition: YM2413Test.cc:20
openmsx::ResampledSoundDevice
Definition: ResampledSoundDevice.hh:15
openmsx::ResampleBlip::generateOutput
bool generateOutput(float *dataOut, unsigned num, EmuTime::param time) override
Definition: ResampleBlip.cc:23
openmsx::BlipBuffer
Definition: BlipBuffer.hh:14
openmsx::DynamicClock
Represents a clock with a variable frequency.
Definition: DynamicClock.hh:16
ResampleAlgo.hh
openmsx::ResampleBlip::ResampleBlip
ResampleBlip(ResampledSoundDevice &input, const DynamicClock &hostClock, unsigned emuSampleRate)
Definition: ResampleBlip.cc:11
openmsx::ResampleBlip
Definition: ResampleBlip.hh:13
DynamicClock.hh
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::ResampleAlgo
Definition: ResampleAlgo.hh:8
openmsx::FixedPoint< 16 >