29 [[nodiscard]]
const std::string&
getName()
const {
return name; }
34 [[nodiscard]] std::string_view
getDescription()
const {
return description; }
59 return {f * softwareVolumeLeft, f * softwareVolumeRight};
88 unsigned numChannels,
unsigned inputRate,
bool stereo);
118 void setInputRate(
unsigned sampleRate) { inputSampleRate = sampleRate; }
119 [[nodiscard]]
unsigned getInputRate()
const {
return inputSampleRate; }
148 EmuTime::param time) = 0;
159 static void addFill(
float*& buffer,
float value,
unsigned num);
188 [[nodiscard]]
bool mixChannels(
float* dataOut,
unsigned samples);
196 const std::string name;
201 float softwareVolumeLeft = 1.0f;
202 float softwareVolumeRight = 1.0f;
203 unsigned inputSampleRate;
204 const unsigned numChannels;
205 const unsigned stereo;
206 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.
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.
AmplificationFactors getAmplificationFactor() const
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)
virtual void setOutputRate(unsigned hostSampleRate, double speed)=0
When a SoundDevice registers itself with the Mixer, the Mixer sets the required sampleRate through th...
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.
SoundDevice(const SoundDevice &)=delete
SoundDevice & operator=(const SoundDevice &)=delete
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.
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
Gets this device its 'amplification factor'.