Switchboard SDK
Loading...
Searching...
No Matches
switchboard::SynthNode Class Reference

Generates a sine wave modulated by an ADSR envelope. More...

#include <SynthNode.hpp>

Inheritance diagram for switchboard::SynthNode:

Public Member Functions

SB_WASM SynthNode ()
 Creates a SynthNode instance.
 
SB_WASM float getFrequency () const
 Gets the current frequency value of the generated sine wave.
 
SB_WASM void setFrequency (const float frequency)
 Sets the frequency of the generated sine wave.
 
SB_WASM void setAttackSeconds (float attackSeconds)
 Sets the attack time of the generated envelope.
 
SB_WASM float getAttackSeconds () const
 Gets the current attack time of the generated envelope.
 
SB_WASM void setDecaySeconds (float decaySeconds)
 Sets the decay time of the generated envelope.
 
SB_WASM float getDecaySeconds () const
 Gets the current decay time of the generated envelope.
 
SB_WASM void setReleaseSeconds (float releaseSeconds)
 Sets the release time of the generated envelope.
 
SB_WASM float getReleaseSeconds () const
 Gets the current release time of the generated envelope.
 
SB_WASM void setPeakLevel (float peakLevel)
 Sets the peak level of the generated envelope (the level reached by attack).
 
SB_WASM float getPeakLevel () const
 Gets the current peak level of the generated envelope (the level reached by attack).
 
SB_WASM void setSustainLevel (float sustainLevel)
 Sets the sustain level of the generated envelope.
 
SB_WASM float getSustainLevel () const
 Gets the current sustain level of the generated envelope.
 
SB_WASM void trigger ()
 Trigger the synth.
 
SB_WASM void release ()
 Release the synth.
 
SB_WASM bool setBusFormat (AudioBusFormat &busFormat) override
 
SB_WASM bool produce (AudioBus &bus) override
 

Detailed Description

Generates a sine wave modulated by an ADSR envelope.

SynthNode class.

Member Function Documentation

◆ getAttackSeconds()

float switchboard::SynthNode::getAttackSeconds ( ) const

Gets the current attack time of the generated envelope.

Returns
The attack time in seconds.

◆ getDecaySeconds()

float switchboard::SynthNode::getDecaySeconds ( ) const

Gets the current decay time of the generated envelope.

Returns
The decay time in seconds.

◆ getFrequency()

float switchboard::SynthNode::getFrequency ( ) const

Gets the current frequency value of the generated sine wave.

Returns
The frequency value in Hz.

◆ getPeakLevel()

float switchboard::SynthNode::getPeakLevel ( ) const

Gets the current peak level of the generated envelope (the level reached by attack).

Returns
The peak level in the range of 0.0..1.0.

◆ getReleaseSeconds()

float switchboard::SynthNode::getReleaseSeconds ( ) const

Gets the current release time of the generated envelope.

Returns
The release time in seconds.

◆ getSustainLevel()

float switchboard::SynthNode::getSustainLevel ( ) const

Gets the current sustain level of the generated envelope.

Returns
The sustain level in the range of 0.0..1.0.

◆ release()

void switchboard::SynthNode::release ( )

Release the synth.

The generator will stop generating sound.

◆ setAttackSeconds()

void switchboard::SynthNode::setAttackSeconds ( float attackSeconds)

Sets the attack time of the generated envelope.

Parameters
attackSecondsThe new attack time value in seconds.

◆ setDecaySeconds()

void switchboard::SynthNode::setDecaySeconds ( float decaySeconds)

Sets the decay time of the generated envelope.

Parameters
decaySecondsThe new decay time value in seconds.

◆ setFrequency()

void switchboard::SynthNode::setFrequency ( const float frequency)

Sets the frequency of the generated sine wave.

Parameters
frequencyThe new frequency value in Hz.

◆ setPeakLevel()

void switchboard::SynthNode::setPeakLevel ( float peakLevel)

Sets the peak level of the generated envelope (the level reached by attack).

Parameters
peakLevelThe new peak level value in the range of 0.0..1.0.

◆ setReleaseSeconds()

void switchboard::SynthNode::setReleaseSeconds ( float releaseSeconds)

Sets the release time of the generated envelope.

Parameters
releaseSecondsThe new release time value in seconds.

◆ setSustainLevel()

void switchboard::SynthNode::setSustainLevel ( float sustainLevel)

Sets the sustain level of the generated envelope.

Parameters
sustainLevelThe new sustain level value in the range of 0.0..1.0.

◆ trigger()

void switchboard::SynthNode::trigger ( )

Trigger the synth.

The synth will start to generate sound.