26 [[nodiscard]]
const std::string&
getName()
const {
return name; }
31 [[nodiscard]] std::string_view
getDescription()
const {
return description; }
52 return {f * softwareVolumeLeft, f * softwareVolumeRight};
81 unsigned numChannels,
unsigned inputRate,
bool stereo);
111 void setInputRate(
unsigned sampleRate) { inputSampleRate = sampleRate; }
112 [[nodiscard]]
unsigned getInputRate()
const {
return inputSampleRate; }
141 EmuTime::param time) = 0;
152 static void addFill(
float*& buffer,
float value,
unsigned num);
181 [[nodiscard]]
bool mixChannels(
float* dataOut,
unsigned samples);
189 const std::string name;
194 float softwareVolumeLeft = 1.0f;
195 float softwareVolumeRight = 1.0f;
196 unsigned inputSampleRate;
197 const unsigned numChannels;
198 const unsigned stereo;
199 unsigned numRecordChannels;
Represents a clock with a variable frequency.
This class represents a filename.
double getEffectiveSpeed() const
std::string_view getDescription() const
Gets a description of this sound device, to be presented to the user.
virtual void setOutputRate(unsigned sampleRate)=0
When a SoundDevice registers itself with the Mixer, the Mixer sets the required sampleRate through th...
std::pair< float, float > getAmplificationFactor() const
Gets this device its 'amplification factor'.
void recordChannel(unsigned channel, const Filename &filename)
virtual void generateChannels(float **buffers, unsigned num)=0
Abstract method to generate the actual sound data.
void updateStream(EmuTime::param time)
unsigned getInputRate() const
virtual bool updateBuffer(unsigned length, float *buffer, EmuTime::param time)=0
Generate sample data.
bool mixChannels(float *dataOut, unsigned samples)
Calls generateChannels() and combines the output to a single channel.
static void addFill(float *&buffer, float value, unsigned num)
Adds a number of samples that all have the same value.
const DynamicClock & getHostSampleClock() const
See MSXMixer::getHostSampleClock().
void setInputRate(unsigned sampleRate)
void setSoftwareVolume(float volume, EmuTime::param time)
Change the 'software volume' of this sound device.
static constexpr unsigned MAX_CHANNELS
void unregisterSound()
Unregisters this sound device with the Mixer.
bool isStereo() const
Is this a stereo device? This is set in the constructor and cannot be changed anymore.
const std::string & getName() const
Get the unique name that identifies this sound device.
SoundDevice(MSXMixer &mixer, std::string_view name, static_string_view description, unsigned numChannels, unsigned inputRate, bool stereo)
Constructor.
void registerSound(const DeviceConfig &config)
Registers this sound device with the Mixer.
void muteChannel(unsigned channel, bool muted)
virtual float getAmplificationFactorImpl() const
Get amplification/attenuation factor for this device.
T length(const vecN< N, T > &x)
This file implemented 3 utility functions:
constexpr const char *const filename