Package voltage.controllers

# Class ADSREnvelope

java.lang.Object
voltage.controllers.ADSREnvelope

public class ADSREnvelope extends Object
A traditional attack, decay, sustain, release envelope.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `ADSREnvelope.ENV_STAGE`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final double`
  `MIN_TIME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ADSREnvelope()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `AdvanceSample()`
  Makes the envelope process a single sample.
  `ADSREnvelope.ENV_STAGE`
  `GetStage()`
  Get the stage of the envelope.
  `double`
  `GetValue()`
  Gets the envelope's current value.
  `void`
  `Reset()`
  Resets the envelope.
  `void`
  `SetAttackHoldTime(double attackHoldTime)`
  Set the amount of time to stay at 100% level.
  `void`
  `SetAttackTime(double attackTime)`
  Set the amount of time for the envelope to ramp up to the decay level.
  `void`
  `SetDecayTime(double decayTime)`
  Set the amount of time to decay from attack hold (100% level) to the sustain level.
  `void`
  `SetFastAttack(boolean bFastAttack)`
  Sets the attack curve.
  `void`
  `SetGate(boolean gate)`
  Trigger the gate to start the envelope
  `void`
  `SetReleaseTime(double releaseTime)`
  Set the amount of time for the release stage.
  `void`
  `SetSustainLevel(double sustainLevel)`
  Sets the sustain level.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### MIN_TIME

    public final double MIN_TIME
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ADSREnvelope

    public ADSREnvelope()

- ## Method Details

  - ### SetFastAttack

    public void SetFastAttack(boolean bFastAttack)
    Sets the attack curve.
    Parameters:
      `bFastAttack` - set to true for a fast attack curve. Fast attack uses an exponential curve that jumps up quickly. The default curve or slow curve stays low and then jumps up at the end.

  - ### SetAttackTime

    public void SetAttackTime(double attackTime)
    Set the amount of time for the envelope to ramp up to the decay level.
    Parameters:
      `attackTime` - time in milliseconds. Must be greater than 0 milliseconds.

  - ### SetAttackHoldTime

    public void SetAttackHoldTime(double attackHoldTime)
    Set the amount of time to stay at 100% level.
    Parameters:
      `attackHoldTime` - milliseconds.

  - ### SetDecayTime

    public void SetDecayTime(double decayTime)
    Set the amount of time to decay from attack hold (100% level) to the sustain level.
    Parameters:
      `decayTime` - milliseconds.

  - ### SetSustainLevel

    public void SetSustainLevel(double sustainLevel)
    Sets the sustain level.
    Parameters:
      `sustainLevel` - valid ranges are from 0.0 to 5.0

  - ### SetReleaseTime

    public void SetReleaseTime(double releaseTime)
    Set the amount of time for the release stage.
    Parameters:
      `releaseTime` - milliseconds.

  - ### SetGate

    public void SetGate(boolean gate)
    Trigger the gate to start the envelope
    Parameters:
      `gate` - set to true to start the envelope.

  - ### GetValue

    public double GetValue()
    Gets the envelope's current value.
    Returns:
      the value of the envelope. (0 to 5.0)

  - ### AdvanceSample

    public void AdvanceSample()
    Makes the envelope process a single sample. Call this *once* per ProcessSample() function.
    See Also:
      - `VoltageModule.ProcessSample()`

  - ### GetStage

    public ADSREnvelope.ENV_STAGE GetStage()
    Get the stage of the envelope.
    Returns:
      the current stage.

  - ### Reset

    public void Reset()
    Resets the envelope. This resets the output to 0 and the stage back to Off.