openMSX
ResampleAlgo.hh
Go to the documentation of this file.
1 #ifndef RESAMPLEALGO_HH
2 #define RESAMPLEALGO_HH
3 
4 #include "EmuTime.hh"
6 
7 namespace openmsx {
8 
9 class DynamicClock;
10 
12 {
13 public:
14  virtual ~ResampleAlgo() = default;
15 
16  bool generateOutput(float* dataOut, unsigned num, EmuTime::param time)
17  {
18  bool result = generateOutputImpl(dataOut, num, time);
19  auto& emuClk = getEmuClock(); (void)emuClk;
20  assert(emuClk.getTime() <= time);
21  assert(emuClk.getFastAdd(1) > time);
22  return result;
23  }
24 
25 protected:
26  ResampleAlgo(ResampledSoundDevice& input_) : input(input_) {}
27  DynamicClock& getEmuClock() const { return input.getEmuClock(); }
28  virtual bool generateOutputImpl(float* dataOut, unsigned num,
29  EmuTime::param time) = 0;
30 
31 protected:
33 };
34 
35 } // namespace openmsx
36 
37 #endif
openmsx::ResampleAlgo::input
ResampledSoundDevice & input
Definition: ResampleAlgo.hh:32
openmsx::ResampledSoundDevice
Definition: ResampledSoundDevice.hh:17
openmsx::ResampleAlgo::getEmuClock
DynamicClock & getEmuClock() const
Definition: ResampleAlgo.hh:27
openmsx::DynamicClock
Represents a clock with a variable frequency.
Definition: DynamicClock.hh:17
openmsx::ResampleAlgo::generateOutputImpl
virtual bool generateOutputImpl(float *dataOut, unsigned num, EmuTime::param time)=0
openmsx::ResampleAlgo::ResampleAlgo
ResampleAlgo(ResampledSoundDevice &input_)
Definition: ResampleAlgo.hh:26
openmsx::ResampledSoundDevice::getEmuClock
DynamicClock & getEmuClock()
Definition: ResampledSoundDevice.hh:27
EmuTime.hh
openmsx::ResampleAlgo::generateOutput
bool generateOutput(float *dataOut, unsigned num, EmuTime::param time)
Definition: ResampleAlgo.hh:16
openmsx::ResampleAlgo::~ResampleAlgo
virtual ~ResampleAlgo()=default
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::DynamicClock
DynamicClock
Definition: DynamicClock.cc:26
openmsx::ResampleAlgo
Definition: ResampleAlgo.hh:12
ResampledSoundDevice.hh