Class ADSRParams

java.lang.Object
net.paulhertz.pixelaudio.sampler.ADSRParams

public class ADSRParams extends Object
Value object for Minim ADSR parameters. Minim's implementation of a typical ADSR (attack, decay, sustain, release) envelope doesn't allow us to retrieve the values of its parameters after it's been created. This wrapper for ADSR makes those values available.
  • Field Details

    • maxAmp

      private final float maxAmp
    • attack

      private final float attack
    • decay

      private final float decay
    • sustain

      private final float sustain
    • release

      private final float release
  • Constructor Details

    • ADSRParams

      public ADSRParams(float maxAmp, float attack, float decay, float sustain, float release)
      Construct an ADSRParams object - note that duration of the envelope is calculated up to but not including release time.
      Parameters:
      maxAmp - maximum amplitude (0..1)
      attack - attack time in seconds
      decay - decay time in seconds
      sustain - sustain amplitude 90..1)
      release - release time in seconds
  • Method Details

    • getMaxAmp

      public float getMaxAmp()
    • getAttack

      public float getAttack()
    • getDecay

      public float getDecay()
    • getSustain

      public float getSustain()
    • getRelease

      public float getRelease()
    • copy

      public ADSRParams copy()
      Returns:
      a copy of this ADSRParams object
    • toADSR

      public ddf.minim.ugens.ADSR toADSR()
      Build a fresh Minim ADSR from these parameters.
      Returns:
      a Minim ADSR constructed with the instance variable stored in ADSRParams
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      a String representation of the ADSRParams data