Skip to content

daisysp::AdEnv

More...

#include <adenv.h>

Public Functions

Name
AdEnv()
~AdEnv()
void Init(float sample_rate)
float Process()
void Trigger()
void SetTime(uint8_t seg, float time)
void SetCurve(float scalar)
void SetMin(float min)
void SetMax(float max)
float GetValue() const
uint8_t GetCurrentSegment()
bool IsRunning() const

Detailed Description

class daisysp::AdEnv;

Author: shensley

Todo:

  • Add Cycling

  • Implement Curve (its only linear for now).

  • Maybe make this an ADsr_ that has AD/AR/Asr_ modes.

Trigger-able envelope with adjustable min/max, and independent per-segment time control.

Public Functions Documentation

function AdEnv

inline AdEnv()

function ~AdEnv

inline ~AdEnv()

function Init

void Init(
    float sample_rate
)

Parameters:

  • sample_rate sample rate of the audio engine being run

Initializes the ad envelope.

Defaults:

  • current segment = idle
  • curve = linear
  • phase = 0
  • min = 0
  • max = 1

function Process

float Process()

Return: the current envelope value.

Processes the current sample of the envelope. This should be called once per sample period.


function Trigger

inline void Trigger()

Starts or retriggers the envelope.


function SetTime

inline void SetTime(
    uint8_t seg,
    float time
)

Sets the length of time (in seconds) for a specific segment.


function SetCurve

inline void SetCurve(
    float scalar
)

Sets the amount of curve applied. A positve value will create a log curve. Input range: -100 to 100. (or more)


function SetMin

inline void SetMin(
    float min
)

Sets the minimum value of the envelope output. Input range: -FLTmax_, to FLTmax_


function SetMax

inline void SetMax(
    float max
)

Sets the maximum value of the envelope output. Input range: -FLTmax_, to FLTmax_


function GetValue

inline float GetValue() const

Returns the current output value without processing the next sample


function GetCurrentSegment

inline uint8_t GetCurrentSegment()

Returns the segment of the envelope that the phase is currently located in.


function IsRunning

inline bool IsRunning() const

Returns true if the envelope is currently in any stage apart from idle.

---

Updated on 2024-01-03 at 19:38:46 +0000