22 unsigned inputSampleRate_,
bool stereo_)
23 :
SoundDevice(motherBoard.getMSXMixer(), name_, description_,
24 channels, inputSampleRate_, stereo_)
25 , resampleSetting(motherBoard.getReactor().getGlobalSettings().getResampleSetting())
27 resampleSetting.
attach(*
this);
32 resampleSetting.
detach(*
this);
43 return algo->generateOutput(buffer, length, time);
54 assert(&
setting == &resampleSetting);
66 if (outputPeriod == inputPeriod) {
67 algo = std::make_unique<ResampleTrivial>(*
this);
69 switch (resampleSetting.
getEnum()) {
72 algo = std::make_unique<ResampleHQ<1>>(*
this, hostClock);
74 algo = std::make_unique<ResampleHQ<2>>(*
this, hostClock);
79 algo = std::make_unique<ResampleBlip<1>>(*
this, hostClock);
81 algo = std::make_unique<ResampleBlip<2>>(*
this, hostClock);
Represents a clock with a variable frequency.
EmuDuration getPeriod() const
Returns the length of one clock-cycle.
void setPeriod(EmuDuration period)
Set the duration of a clock tick.
void reset(EmuTime::param e)
Reset the clock to start ticking at the given time.
EmuTime::param getTime() const
Gets the time at which the last clock tick occurred.
T getEnum() const noexcept
bool generateInput(float *buffer, size_t num)
Note: To enable various optimizations (like SSE), this method is allowed to generate up to 3 extra sa...
ResampledSoundDevice(MSXMotherBoard &motherBoard, std::string_view name, static_string_view description, unsigned channels, unsigned inputSampleRate, bool stereo)
void update(const Setting &setting) noexcept override
void setOutputRate(unsigned hostSampleRate, double speed) override
When a SoundDevice registers itself with the Mixer, the Mixer sets the required sampleRate through th...
bool updateBuffer(size_t length, float *buffer, EmuTime::param time) override
Generate sample data.
double getEffectiveSpeed() const
unsigned getInputRate() const
const DynamicClock & getHostSampleClock() const
See MSXMixer::getHostSampleClock().
bool mixChannels(float *dataOut, size_t samples)
Calls generateChannels() and combines the output to a single channel.
bool isStereo() const
Is the full output of this device stereo?
void detach(Observer< T > &observer)
void attach(Observer< T > &observer)
This file implemented 3 utility functions: