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