Audaspace 1.5.0
A high level audio library.
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ADSR Class Reference

The ADSR effect implements the Attack-Delay-Sustain-Release behaviour of a sound. More...

#include <ADSR.h>

Inheritance diagram for ADSR:
Inheritance graph
[legend]

Public Member Functions

 ADSR (std::shared_ptr< ISound > sound, float attack, float decay, float sustain, float release)
 Creates a new ADSR object.
 
float getAttack () const
 Returns the attack time.
 
void setAttack (float attack)
 Sets the attack time.
 
float getDecay () const
 Returns the decay time.
 
void setDecay (float decay)
 Sets the decay time.
 
float getSustain () const
 Returns the sustain level.
 
void setSustain (float sustain)
 Sets the sustain level.
 
float getRelease () const
 Returns the release time.
 
void setRelease (float release)
 Sets the release time.
 
virtual std::shared_ptr< IReadercreateReader ()
 Creates a reader for playback of the sound source.
 
- Public Member Functions inherited from Effect
 Effect (std::shared_ptr< ISound > sound)
 Creates a new sound.
 
virtual ~Effect ()
 Destroys the sound.
 
std::shared_ptr< ISoundgetSound () const
 Returns the saved sound.
 
- Public Member Functions inherited from ISound
virtual ~ISound ()
 Destroys the sound.
 

Additional Inherited Members

- Protected Member Functions inherited from Effect
std::shared_ptr< IReadergetReader () const
 Returns the reader created out of the sound.
 
- Protected Attributes inherited from Effect
std::shared_ptr< ISoundm_sound
 If there is no reader it is created out of this sound.
 

Detailed Description

The ADSR effect implements the Attack-Delay-Sustain-Release behaviour of a sound.

Constructor & Destructor Documentation

◆ ADSR()

ADSR::ADSR ( std::shared_ptr< ISound > sound,
float attack,
float decay,
float sustain,
float release )

Creates a new ADSR object.

Parameters
soundThe sound to apply this effect to.
attackThe attack time in seconds.
decayThe decay time in seconds.
sustainThe sustain level as linear volume.
releaseThe release time in seconds.

Member Function Documentation

◆ 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
ExceptionAn 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
attackThe attack time in seconds.

◆ setDecay()

void ADSR::setDecay ( float decay)

Sets the decay time.

Parameters
decayThe decay time in seconds.

◆ setRelease()

void ADSR::setRelease ( float release)

Sets the release time.

Parameters
releaseThe release time in seconds.

◆ setSustain()

void ADSR::setSustain ( float sustain)

Sets the sustain level.

Parameters
sustainThe sustain level in linear volume.

The documentation for this class was generated from the following file: