6#include "audio_buffer.h"
18 virtual void Generate(std::span<float> output)
noexcept SFFDN_NONBLOCKING = 0;
41 SineWave(
float frequency = 0.0f,
float initial_phase = 0.0f);
70 return phase_increment_;
97 float NextOut() const noexcept SFFDN_NONBLOCKING;
100 float Tick() noexcept SFFDN_NONBLOCKING;
103 void Generate(std::span<
float> output) noexcept SFFDN_NONBLOCKING override;
110 void Multiply(std::span<const
float> input, std::span<
float> output) noexcept SFFDN_NONBLOCKING;
117 void MultiplyAccumulate(std::span<const
float> input, std::span<
float> output) noexcept SFFDN_NONBLOCKING;
121 float phase_increment_;
Base class for oscillators and signal generators.
Definition oscillator.h:12
virtual void Generate(std::span< float > output) noexcept SFFDN_NONBLOCKING=0
Fills the output span with generated samples.
A sine wave oscillator.
Definition oscillator.h:33
void SetOffset(float offset)
Sets the DC offset of the sine wave oscillator.
float GetAmplitude() const
Returns the amplitude of the sine wave oscillator.
float GetFrequency() const noexcept SFFDN_NONBLOCKING
Returns the normalized frequency in cycles per sample.
Definition oscillator.h:68
float GetOffset() const
Returns the DC offset of the sine wave oscillator.
SineWave(float frequency=0.0f, float initial_phase=0.0f)
Constructs a sine wave oscillator.
void ResetPhase()
Resets the phase of the sine wave oscillator.
void SetPhaseOffset(float phase_offset)
Sets the phase offset of the sine wave oscillator.
void SetAmplitude(float amplitude)
Sets the amplitude of the sine wave oscillator.
float GetPhaseOffset() const noexcept SFFDN_NONBLOCKING
Returns the normalized phase offset in cycles.
Definition oscillator.h:91
void SetFrequency(float frequency)
Sets the frequency of the sine wave oscillator.
float GetAmplitudeNonBlocking() const noexcept SFFDN_NONBLOCKING
Returns the amplitude for use from a nonblocking processing path.
Definition oscillator.h:62
float NextOut() const noexcept SFFDN_NONBLOCKING
Returns the next output sample without advancing the phase.