Provides general interface for signal generators.
More...
#include <Generator.hpp>
|
| Generator (const float frequency=440.0f) |
| Generator constructor.
|
|
| Generator (const Generator &generator) |
| Generator copy constructor.
|
|
virtual | ~Generator ()=default |
| Generator destructor.
|
|
float | getFrequency () const |
| Gets the current frequency value of the generated signal.
|
|
void | setFrequency (const float frequency) |
| Sets the frequency of the generated signal.
|
|
float | getAmplitude () const |
| Gets the current amplitude value of the generated signal.
|
|
void | setAmplitude (const float amplitude) |
| Sets the amplitude of the generated signal.
|
|
GeneratorType | getType () |
| Gets the type of the Generator.
|
|
template<typename T > |
void | generate (T *buffer, const uint numberOfSamples, const uint sampleRate) |
| Generates the audio data into a data buffer.
|
|
template<typename T > |
void | generate (AudioBuffer< T > &audioBuffer) |
| Generates the audio data into an audio buffer.
|
|
|
float | phase |
|
GeneratorType | type |
|
Provides general interface for signal generators.
Generator base class
◆ Generator()
switchboard::Generator::Generator |
( |
const float | frequency = 440.0f | ) |
|
Generator constructor.
- Parameters
-
frequency | The initial frequency in Hz. Default value is 440 Hz. |
◆ generate() [1/2]
template<typename T >
void switchboard::Generator::generate |
( |
AudioBuffer< T > & | audioBuffer | ) |
|
Generates the audio data into an audio buffer.
- Parameters
-
audioBuffer | The audio buffer. |
◆ generate() [2/2]
template<typename T >
void switchboard::Generator::generate |
( |
T * | buffer, |
|
|
const uint | numberOfSamples, |
|
|
const uint | sampleRate ) |
Generates the audio data into a data buffer.
- Parameters
-
buffer | The data buffer. |
numberOfSamples | The number of samples to generate. |
sampleRate | The sample rate. |
◆ getAmplitude()
float switchboard::Generator::getAmplitude |
( |
| ) |
const |
Gets the current amplitude value of the generated signal.
- Returns
- The amplitude value.
◆ getFrequency()
float switchboard::Generator::getFrequency |
( |
| ) |
const |
Gets the current frequency value of the generated signal.
- Returns
- The frequency value in Hz.
◆ getType()
GeneratorType switchboard::Generator::getType |
( |
| ) |
|
◆ setAmplitude()
void switchboard::Generator::setAmplitude |
( |
const float | amplitude | ) |
|
Sets the amplitude of the generated signal.
- Parameters
-
amplitude | The new amplitude value. Should be between 0 and 1. |
◆ setFrequency()
void switchboard::Generator::setFrequency |
( |
const float | frequency | ) |
|
Sets the frequency of the generated signal.
- Parameters
-
frequency | The new frequency value in Hz. |