Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

syn::AdsrEnvOsc Class Reference

The ADSR Envelope Generator is a flexible EG that generates a four-stage ADSR voltage envelope that varies from 0 to 1. More...

#include <Generator.h>

List of all members.

Public Methods

 AdsrEnvOsc ()
float lerp (const float lerpVal, const float from, const float to)
float generate ()
 generate wave data... More...

void trigger (float duration=-1)
 trigger the envelope state machine from the beginning. More...

void release ()
void setAttackTime (float t)
 set length of attack stage this is the amount of time in sec to go from 0 to 1 1 | . More...

float getAttackTime ()
void setDecayTime (float t)
 set length of decay stage this is the amount of time in sec to go from 1 to sustain() 1 | . More...

float getDecayTime ()
void setSustainLevel (float sustain)
 set amplitude of the sustain stage this is the level that the ADSR sustains at. More...

float getSustainLevel ()
void setReleaseTime (float t)
 set length of release stage this is the amount of time in sec to go from sustain() to 0 1 | . More...

float getReleaseTime ()
unsigned int samplesPerOsc ()
 get the number of samples for a single oscillation. More...

void setFreq (float freqHz)
 not used in ADSR. More...

void setSampRate (float samplingRateHz)
 set the sampling rate of the generated wave. More...

void reset ()
 reset the waveform phase at 0. More...


Detailed Description

The ADSR Envelope Generator is a flexible EG that generates a four-stage ADSR voltage envelope that varies from 0 to 1.

NOTE: ADSR = (A)ttack, (D)elay, (S)ustain, (R)elease NOTE: this is non-bandlimited...

Definition at line 491 of file Generator.h.


Constructor & Destructor Documentation

syn::AdsrEnvOsc::AdsrEnvOsc ( ) [inline]
 

Definition at line 494 of file Generator.h.


Member Function Documentation

float syn::AdsrEnvOsc::lerp ( const float lerpVal,
const float from,
const float to ) [inline]
 

Definition at line 503 of file Generator.h.

Referenced by generate().

float syn::AdsrEnvOsc::generate ( ) [inline]
 

generate wave data...

Todo:
changing adsr params on the fly might produces clicks...

Definition at line 511 of file Generator.h.

void syn::AdsrEnvOsc::trigger ( float duration = -1 ) [inline]
 

trigger the envelope state machine from the beginning.

Parameters:
duration   optionally specify a duration in seconds before release is automatically called. if none duration is unspecified or set to -1, then adsr actives until release() is called.

Definition at line 571 of file Generator.h.

void syn::AdsrEnvOsc::release ( ) [inline]
 

Definition at line 579 of file Generator.h.

Referenced by generate().

void syn::AdsrEnvOsc::setAttackTime ( float t ) [inline]
 

set length of attack stage this is the amount of time in sec to go from 0 to 1 1 | .

| / \.___ |./ `\ 0 +---+------------ time

Definition at line 591 of file Generator.h.

float syn::AdsrEnvOsc::getAttackTime ( ) [inline]
 

Definition at line 597 of file Generator.h.

void syn::AdsrEnvOsc::setDecayTime ( float t ) [inline]
 

set length of decay stage this is the amount of time in sec to go from 1 to sustain() 1 | .

| / \.___ |./ `\ 0 ----+-+---------- time

Definition at line 606 of file Generator.h.

float syn::AdsrEnvOsc::getDecayTime ( ) [inline]
 

Definition at line 612 of file Generator.h.

void syn::AdsrEnvOsc::setSustainLevel ( float sustain ) [inline]
 

set amplitude of the sustain stage this is the level that the ADSR sustains at.

1 | . | / \.___ |./ | `\ 0 ---------------- t

Definition at line 622 of file Generator.h.

float syn::AdsrEnvOsc::getSustainLevel ( ) [inline]
 

Definition at line 626 of file Generator.h.

void syn::AdsrEnvOsc::setReleaseTime ( float t ) [inline]
 

set length of release stage this is the amount of time in sec to go from sustain() to 0 1 | .

| / \.___ |./ `\ 0 ----------+-+---- time

Definition at line 635 of file Generator.h.

float syn::AdsrEnvOsc::getReleaseTime ( ) [inline]
 

Definition at line 641 of file Generator.h.

unsigned int syn::AdsrEnvOsc::samplesPerOsc ( ) [inline]
 

get the number of samples for a single oscillation.

this tells you how many samples before the osc repeats. useful for filling a wavetable so that it can repeat without pops.

Definition at line 647 of file Generator.h.

void syn::AdsrEnvOsc::setFreq ( float freqHz ) [inline]
 

not used in ADSR.

Definition at line 658 of file Generator.h.

void syn::AdsrEnvOsc::setSampRate ( float samplingRateHz ) [inline]
 

set the sampling rate of the generated wave.

samples per sec.

Definition at line 663 of file Generator.h.

void syn::AdsrEnvOsc::reset ( ) [inline]
 

reset the waveform phase at 0.

Definition at line 674 of file Generator.h.

Referenced by AdsrEnvOsc().


The documentation for this class was generated from the following file:
Generated at Mon Apr 15 09:27:51 2002 for subsynth by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001