10static constexpr unsigned DUMMY_INPUT_RATE = 44100;
14 :
SoundDevice(config.getMotherBoard().getMSXMixer(), name_, desc, 1, DUMMY_INPUT_RATE, false)
24void DACSound16S::setOutputRate(
unsigned hostSampleRate,
double )
36 int delta = value - lastWrittenValue;
37 if (delta == 0)
return;
38 lastWrittenValue = value;
45void DACSound16S::generateChannels(std::span<float*> bufs,
unsigned num)
50 assert(bufs.size() == 1);
56bool DACSound16S::updateBuffer(
size_t length,
float* buffer,
62template<
typename Archive>
68 int16_t lastValue = lastWrittenValue;
69 ar.serialize(
"lastValue", lastValue);
70 if constexpr (Archive::IS_LOADER) {
bool readSamples(float *out, size_t samples)
void addDelta(TimeIndex time, float delta)
DACSound16S(std::string_view name, static_string_view desc, const DeviceConfig &config)
void reset(EmuTime::param time)
void serialize(Archive &ar, unsigned version)
void writeDAC(int16_t value, EmuTime::param time)
unsigned getTicksTill(EmuTime::param e) const
Calculate the number of ticks for this clock until the given time.
A fixed point number, implemented by a 32-bit signed integer.
const DynamicClock & getHostSampleClock() const
See MSXMixer::getHostSampleClock().
void setInputRate(unsigned sampleRate)
bool mixChannels(float *dataOut, size_t samples)
Calls generateChannels() and combines the output to a single channel.
void unregisterSound()
Unregisters this sound device with the Mixer.
void registerSound(const DeviceConfig &config)
Registers this sound device with the Mixer.
This file implemented 3 utility functions:
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)