The Nebula Device 3: Particles::EnvelopeCurve Class Reference

The Nebula Device 3

Particles::EnvelopeCurve Class Reference

#include <envelopecurve.h>


Detailed Description

An Attack/Sustain/Release envelope curve class with optional sine/cosine modulation. Used for animated particle emitter attributes.

(C) 2008 Radon Labs GmbH

Public Types

enum  ModFunc
 modulation enumerator

Public Member Functions

 EnvelopeCurve ()
 default constructor
void Setup (float val0, float val1, float val2, float val3, float keyPos0, float keyPos1, float freq, float amp, ModFunc mod)
 set parameters
float Sample (float t) const
 sample at specific time (0..1)
void PreSample (float *sampleBuffer, SizeT numSamples, SizeT sampleStride) const
 sample from t=0 to t=1 into array of values
float GetMaxValue () const
 get the max of val0, val1, val2, val3

Member Function Documentation

float Particles::EnvelopeCurve::Sample ( float  t  )  const

sample at specific time (0..1)

NOTE: Sampling a single value is relatively expensive. Consider pre-sampling into a lookup table!

void Particles::EnvelopeCurve::PreSample ( float *  sampleBuffer,
SizeT  numSamples,
SizeT  sampleStride 
) const

sample from t=0 to t=1 into array of values

This samples N values from t=0 to t=1 into an array. The array can then be used as a lookup table.