Generates a specified signal to the output.
More...
#include <GeneratorNode.hpp>
|
std::string | name |
| The name of the audio node.
|
|
std::string | type |
|
std::vector< std::unique_ptr< Parameter > > | parameters |
|
Generates a specified signal to the output.
GeneratorNode class
◆ GeneratorNode()
switchboard::GeneratorNode::GeneratorNode |
( |
GeneratorType | generatorType | ) |
|
Creates a GeneratorNode instance.
- Parameters
-
generatorType | The type of the generator. |
◆ getAmplitude()
float switchboard::GeneratorNode::getAmplitude |
( |
| ) |
const |
Gets the current amplitude value of the generated signal.
- Returns
- The amplitude value.
◆ getDutyCycle()
float switchboard::GeneratorNode::getDutyCycle |
( |
| ) |
const |
Gets the current duty cycle of the generated signal.
- Note
- Only used by square wave generator.
- Returns
- The duty cycle value.
◆ getFrequency()
float switchboard::GeneratorNode::getFrequency |
( |
| ) |
const |
Gets the current frequency value of the generated signal.
- Note
- No effect on noise generators.
- Returns
- The frequency value in Hz.
◆ produce()
bool switchboard::GeneratorNode::produce |
( |
AudioBus & | bus | ) |
|
|
overridevirtual |
Produces audio data in the given bus.
Should be overridden by subclasses.
- Parameters
-
bus | The bus that should be filled with audio data. |
- Returns
- True if audio was produced successfully, false otherwise.
Implements switchboard::SingleBusAudioSourceNode.
◆ setAmplitude()
void switchboard::GeneratorNode::setAmplitude |
( |
const float | amplitude | ) |
|
Sets the amplitude of the generated signal.
- Parameters
-
amplitude | The new amplitude value. Should be between 0 and 1. |
◆ setBusFormat()
bool switchboard::GeneratorNode::setBusFormat |
( |
AudioBusFormat & | busFormat | ) |
|
|
overridevirtual |
Sets bus format.
Should be overridden by subclasses.
- Parameters
-
busFormat | The bus format to set. |
- Returns
- True if the bus format was set successfully, false otherwise.
Implements switchboard::SingleBusAudioSourceNode.
◆ setDutyCycle()
void switchboard::GeneratorNode::setDutyCycle |
( |
const float | dutyCycle | ) |
|
Sets the duty cycle of the generated signal.
- Note
- Only used by square wave generator.
- Parameters
-
dutyCycle | The new duty cycle value. Should be between 0 and 1. |
◆ setFrequency()
void switchboard::GeneratorNode::setFrequency |
( |
const float | frequency | ) |
|
Sets the frequency of the generated signal.
- Note
- No effect on noise generators.
- Parameters
-
frequency | The new frequency value in Hz. |