The ADSR effect implements the Attack-Delay-Sustain-Release behaviour of a sound.
More...
#include <ADSR.h>
|
std::shared_ptr< IReader > | getReader () const |
| Returns the reader created out of the sound. More...
|
|
std::shared_ptr< ISound > | m_sound |
| If there is no reader it is created out of this sound.
|
|
The ADSR effect implements the Attack-Delay-Sustain-Release behaviour of a sound.
◆ ADSR()
ADSR::ADSR |
( |
std::shared_ptr< ISound > |
sound, |
|
|
float |
attack, |
|
|
float |
decay, |
|
|
float |
sustain, |
|
|
float |
release |
|
) |
| |
Creates a new ADSR object.
- Parameters
-
sound | The sound to apply this effect to. |
attack | The attack time in seconds. |
decay | The decay time in seconds. |
sustain | The sustain level as linear volume. |
release | The release time in seconds. |
◆ createReader()
virtual std::shared_ptr<IReader> ADSR::createReader |
( |
| ) |
|
|
virtual |
Creates a reader for playback of the sound source.
- Returns
- A pointer to an IReader object or nullptr if there has been an error.
- Exceptions
-
Exception | An exception may be thrown if there has been a more unexpected error during reader creation. |
Implements ISound.
◆ getAttack()
float ADSR::getAttack |
( |
| ) |
const |
Returns the attack time.
- Returns
- The attack time in seconds.
◆ getDecay()
float ADSR::getDecay |
( |
| ) |
const |
Returns the decay time.
- Returns
- The decay time in seconds.
◆ getRelease()
float ADSR::getRelease |
( |
| ) |
const |
Returns the release time.
- Returns
- The release time in seconds.
◆ getSustain()
float ADSR::getSustain |
( |
| ) |
const |
Returns the sustain level.
- Returns
- The sustain level in linear volume.
◆ setAttack()
void ADSR::setAttack |
( |
float |
attack | ) |
|
Sets the attack time.
- Parameters
-
attack | The attack time in seconds. |
◆ setDecay()
void ADSR::setDecay |
( |
float |
decay | ) |
|
Sets the decay time.
- Parameters
-
decay | The decay time in seconds. |
◆ setRelease()
void ADSR::setRelease |
( |
float |
release | ) |
|
Sets the release time.
- Parameters
-
release | The release time in seconds. |
◆ setSustain()
void ADSR::setSustain |
( |
float |
sustain | ) |
|
Sets the sustain level.
- Parameters
-
sustain | The sustain level in linear volume. |
The documentation for this class was generated from the following file: