A sine wave oscillator.
More...
#include <oscillator.h>
|
| | 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 | SetFrequency (float frequency) |
| | Sets the frequency of the sine wave oscillator.
|
| |
| void | SetAmplitude (float amplitude) |
| | Sets the amplitude of the sine wave oscillator.
|
| |
| float | GetAmplitude () const |
| | Returns the amplitude of the sine wave oscillator.
|
| |
| void | SetOffset (float offset) |
| | Sets the DC offset of the sine wave oscillator.
|
| |
| float | GetOffset () const |
| | Returns the DC offset of the sine wave oscillator.
|
| |
| void | SetPhaseOffset (float phase_offset) |
| | Sets the phase offset of the sine wave oscillator.
|
| |
|
float | NextOut () const |
| | Returns the next output sample without advancing the phase.
|
| |
|
float | Tick () |
| | Advances the phase and returns the next output sample.
|
| |
| void | Generate (std::span< float > output) override |
| | Fills the output span with generated samples.
|
| |
| void | Multiply (std::span< const float > input, std::span< float > output) |
| | Multiply input by the sine wave and store the result in output.
|
| |
| void | MultiplyAccumulate (std::span< const float > input, std::span< float > output) |
| | Multiply input by the sine wave and accumulate the result in output.
|
| |
A sine wave oscillator.
The output of the oscillator is given by: output = (sin(phase) * amplitude) + offset
◆ SineWave()
| sfFDN::SineWave::SineWave |
( |
float | frequency = 0.0f, |
|
|
float | initial_phase = 0.0f ) |
Constructs a sine wave oscillator.
- Parameters
-
| frequency | The frequency of the sine wave in, normalized [0, 1]. |
| initial_phase | The initial phase of the sine wave, normalized [0, 1]. |
The normalized frequency is obtained by dividing the desired frequency in Hz by the sample rate.
◆ Generate()
| void sfFDN::SineWave::Generate |
( |
std::span< float > | output | ) |
|
|
overridevirtual |
◆ GetAmplitude()
| float sfFDN::SineWave::GetAmplitude |
( |
| ) |
const |
Returns the amplitude of the sine wave oscillator.
- Returns
- The amplitude of the sine wave oscillator.
◆ GetOffset()
| float sfFDN::SineWave::GetOffset |
( |
| ) |
const |
Returns the DC offset of the sine wave oscillator.
- Returns
- The DC offset of the sine wave oscillator.
◆ Multiply()
| void sfFDN::SineWave::Multiply |
( |
std::span< const float > | input, |
|
|
std::span< float > | output ) |
Multiply input by the sine wave and store the result in output.
- Parameters
-
| input | The input signal to modulate. |
| output | The output signal to store the result. |
◆ MultiplyAccumulate()
| void sfFDN::SineWave::MultiplyAccumulate |
( |
std::span< const float > | input, |
|
|
std::span< float > | output ) |
Multiply input by the sine wave and accumulate the result in output.
- Parameters
-
| input | The input signal to modulate. |
| output | The output signal to store the result. |
◆ SetAmplitude()
| void sfFDN::SineWave::SetAmplitude |
( |
float | amplitude | ) |
|
Sets the amplitude of the sine wave oscillator.
- Parameters
-
| amplitude | The amplitude of the sine wave. |
◆ SetFrequency()
| void sfFDN::SineWave::SetFrequency |
( |
float | frequency | ) |
|
Sets the frequency of the sine wave oscillator.
- Parameters
-
| frequency | The frequency of the sine wave in, normalized [0, 1]. |
◆ SetOffset()
| void sfFDN::SineWave::SetOffset |
( |
float | offset | ) |
|
Sets the DC offset of the sine wave oscillator.
- Parameters
-
| offset | The offset of the sine wave. |
The offset is a scalar value added to the output of the sine wave.
◆ SetPhaseOffset()
| void sfFDN::SineWave::SetPhaseOffset |
( |
float | phase_offset | ) |
|
Sets the phase offset of the sine wave oscillator.
- Parameters
-
| phase_offset | The phase offset, normalized [0, 1]. |
The documentation for this class was generated from the following file: