Switchboard SDK
|
Generates a sine wave modulated by an ADSR envelope. More...
#include <SynthNode.hpp>
Public Member Functions | |
WASM | SynthNode () |
Creates a SynthNode instance. | |
WASM float | getFrequency () const |
Gets the current frequency value of the generated sine wave. | |
WASM void | setFrequency (const float frequency) |
Sets the frequency of the generated sine wave. | |
WASM void | setAttackSeconds (float attackSeconds) |
Sets the attack time of the generated envelope. | |
WASM float | getAttackSeconds () const |
Gets the current attack time of the generated envelope. | |
WASM void | setDecaySeconds (float decaySeconds) |
Sets the decay time of the generated envelope. | |
WASM float | getDecaySeconds () const |
Gets the current decay time of the generated envelope. | |
WASM void | setReleaseSeconds (float releaseSeconds) |
Sets the release time of the generated envelope. | |
WASM float | getReleaseSeconds () const |
Gets the current release time of the generated envelope. | |
WASM void | setPeakLevel (float peakLevel) |
Sets the peak level of the generated envelope (the level reached by attack). | |
WASM float | getPeakLevel () const |
Gets the current peak level of the generated envelope (the level reached by attack). | |
WASM void | setSustainLevel (float sustainLevel) |
Sets the sustain level of the generated envelope. | |
WASM float | getSustainLevel () const |
Gets the current sustain level of the generated envelope. | |
WASM void | trigger () |
Trigger the synth. | |
WASM void | release () |
Release the synth. | |
WASM bool | setBusFormat (AudioBusFormat &busFormat) override |
Sets bus format. | |
WASM bool | produce (AudioBus &bus) override |
Produces audio data in the given bus. | |
Public Member Functions inherited from switchboard::SingleBusAudioSourceNode | |
bool | setNumberOfBuses (const uint numberOfBuses) override |
Sets number of buses. | |
bool | setBusFormats (AudioBusFormatList &busFormats) override |
Sets bus formats. | |
bool | produce (AudioBusList &buses) override |
Produces audio data in the given buses. | |
Public Member Functions inherited from switchboard::AudioNode | |
AudioNode () | |
AudioNode constructor. | |
virtual | ~AudioNode ()=default |
AudioNode virtual destructor. | |
const std::string & | getType () const |
Gets the type of the audio node. | |
virtual const std::string | getDisplayName () const |
Gets the display name of the audio node. | |
virtual std::vector< std::unique_ptr< Parameter > > & | getParameters () |
Gets the parameters of the audio node. | |
virtual Parameter * | getParameter (const std::string &name) |
Gets the parameter with the given name. | |
Additional Inherited Members | |
Public Attributes inherited from switchboard::AudioNode | |
std::string | name |
The name of the audio node. | |
Protected Attributes inherited from switchboard::AudioNode | |
std::string | type |
std::vector< std::unique_ptr< Parameter > > | parameters |
Generates a sine wave modulated by an ADSR envelope.
SynthNode class.
float switchboard::SynthNode::getAttackSeconds | ( | ) | const |
Gets the current attack time of the generated envelope.
float switchboard::SynthNode::getDecaySeconds | ( | ) | const |
Gets the current decay time of the generated envelope.
float switchboard::SynthNode::getFrequency | ( | ) | const |
Gets the current frequency value of the generated sine wave.
float switchboard::SynthNode::getPeakLevel | ( | ) | const |
Gets the current peak level of the generated envelope (the level reached by attack).
float switchboard::SynthNode::getReleaseSeconds | ( | ) | const |
Gets the current release time of the generated envelope.
float switchboard::SynthNode::getSustainLevel | ( | ) | const |
Gets the current sustain level of the generated envelope.
|
overridevirtual |
Produces audio data in the given bus.
Should be overridden by subclasses.
bus | The bus that should be filled with audio data. |
Implements switchboard::SingleBusAudioSourceNode.
void switchboard::SynthNode::release | ( | ) |
Release the synth.
The generator will stop generating sound.
void switchboard::SynthNode::setAttackSeconds | ( | float | attackSeconds | ) |
Sets the attack time of the generated envelope.
attackSeconds | The new attack time value in seconds. |
|
overridevirtual |
Sets bus format.
Should be overridden by subclasses.
busFormat | The bus format to set. |
Implements switchboard::SingleBusAudioSourceNode.
void switchboard::SynthNode::setDecaySeconds | ( | float | decaySeconds | ) |
Sets the decay time of the generated envelope.
decaySeconds | The new decay time value in seconds. |
void switchboard::SynthNode::setFrequency | ( | const float | frequency | ) |
Sets the frequency of the generated sine wave.
frequency | The new frequency value in Hz. |
void switchboard::SynthNode::setPeakLevel | ( | float | peakLevel | ) |
Sets the peak level of the generated envelope (the level reached by attack).
peakLevel | The new peak level value in the range of 0.0..1.0. |
void switchboard::SynthNode::setReleaseSeconds | ( | float | releaseSeconds | ) |
Sets the release time of the generated envelope.
releaseSeconds | The new release time value in seconds. |
void switchboard::SynthNode::setSustainLevel | ( | float | sustainLevel | ) |
Sets the sustain level of the generated envelope.
sustainLevel | The new sustain level value in the range of 0.0..1.0. |
void switchboard::SynthNode::trigger | ( | ) |
Trigger the synth.
The synth will start to generate sound.