23 unsigned inputSampleRate_,
bool stereo_)
24 :
SoundDevice(motherBoard.getMSXMixer(), name_, description_,
25 channels, inputSampleRate_, stereo_)
26 , resampleSetting(motherBoard.getReactor().getGlobalSettings().getResampleSetting())
28 resampleSetting.
attach(*
this);
33 resampleSetting.
detach(*
this);
44 return algo->generateOutput(buffer, length, time);
55 assert(&
setting == &resampleSetting);
67 if (outputPeriod == inputPeriod) {
68 algo = std::make_unique<ResampleTrivial>(*
this);
70 switch (resampleSetting.
getEnum()) {
73 algo = std::make_unique<ResampleHQ<1>>(*
this, hostClock);
75 algo = std::make_unique<ResampleHQ<2>>(*
this, hostClock);
87 algo = std::make_unique<ResampleBlip<1>>(*
this, hostClock);
89 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
static std::unique_ptr< ResampleLQ< CHANNELS > > create(ResampledSoundDevice &input, const DynamicClock &hostClock)
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: