ddf.minim.ugens
Class Damp

java.lang.Object
  extended by ddf.minim.ugens.UGen
      extended by ddf.minim.ugens.Damp

public class Damp
extends UGen

A UGen that starts at an amplitude value and changes to zero over a specified time. All times are measured in seconds.

Author:
Anderson Mills

Nested Class Summary
 
Nested classes/interfaces inherited from class ddf.minim.ugens.UGen
UGen.InputType, UGen.UGenInput
 
Field Summary
 UGen.UGenInput audio
          The default input is "audio." You don't need to patch directly to this input, patching to the UGen itself will accomplish the same thing.
 
Constructor Summary
Damp()
          Constructor for Damp envelope.
Damp(float dampTime)
          Constructor for Damp envelope.
Damp(float attackTime, float dampTime)
          Constructor for Damp envelope.
Damp(float attackTime, float dampTime, float maxAmp)
          Constructor for Damp envelope.
Damp(float attackTime, float dampTime, float maxAmp, float befAmp, float aftAmp)
          Constructor for Damp envelope.
 
Method Summary
 void activate()
          Specifies that the damp envelope should begin.
protected  void sampleRateChanged()
          Override this method in your derived class to receive a notification when the sample rate of your UGen has changed.
 void setAttackTime(float attackTime)
          Permits the setting of the attackTime parameter.
 void setDampTime(float dampTime)
          Permits the setting of the attackTime parameter.
 void setDampTimeFromDuration(float duration)
          Permits the setting of the attackTime parameter.
protected  void uGenerate(float[] channels)
          Implement this method when you extend UGen.
 void unpatchAfterDamp(AudioOutput output)
          Tell the Damp that it should unpatch itself from the output after the release time.
 
Methods inherited from class ddf.minim.ugens.UGen
addInput, getLastValues, patch, patch, patch, printInputs, removeInput, sampleRate, setSampleRate, tick, unpatch, unpatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

audio

public UGen.UGenInput audio
The default input is "audio." You don't need to patch directly to this input, patching to the UGen itself will accomplish the same thing.

Constructor Detail

Damp

public Damp()
Constructor for Damp envelope. attackTime, rise time of the damp envelope, defaults to 0. dampTime, decay time of the damp envelope, defaults to 1. maxAmp, maximum amlitude of the damp envelope, defaults to 1. befAmp, amplitude before the damp envelope, and aftAmp, amplitude after the damp envelope, default to 0.


Damp

public Damp(float dampTime)
Constructor for Damp envelope. attackTime, rise time of the damp envelope, defaults to 0. maxAmp, maximum amlitude of the damp envelope, defaults to 1. befAmp, amplitude before the damp envelope, and aftAmp, amplitude after the damp envelope, default to 0.

Parameters:
dampTime - decay time of the damp envelope

Damp

public Damp(float attackTime,
            float dampTime)
Constructor for Damp envelope. maxAmp, maximum amlitude of the damp envelope, defaults to 1. befAmp, amplitude before the damp envelope, and aftAmp, amplitude after the damp envelope, default to 0.

Parameters:
attackTime - rise time of the damp envelope
dampTime - decay time of the damp envelope

Damp

public Damp(float attackTime,
            float dampTime,
            float maxAmp)
Constructor for Damp envelope. befAmp, amplitude before the damp envelope, and aftAmp, amplitude after the damp envelope, default to 0.

Parameters:
attackTime - rise time of the damp envelope
dampTime - decay time of the damp envelope
maxAmp - maximum amlitude of the damp envelope

Damp

public Damp(float attackTime,
            float dampTime,
            float maxAmp,
            float befAmp,
            float aftAmp)
Constructor for Damp envelope.

Parameters:
attackTime - rise time of the damp envelope
dampTime - decay time of the damp envelope
maxAmp - maximum amlitude of the damp envelope
befAmp - amplitude before the damp envelope
aftAmp - amplitude after the damp envelope
Method Detail

activate

public void activate()
Specifies that the damp envelope should begin.


setAttackTime

public void setAttackTime(float attackTime)
Permits the setting of the attackTime parameter.

Parameters:
attackTime - rise time of the damp envelope

setDampTime

public void setDampTime(float dampTime)
Permits the setting of the attackTime parameter.

Parameters:
dampTime - decay time of the damp envelope

setDampTimeFromDuration

public void setDampTimeFromDuration(float duration)
Permits the setting of the attackTime parameter. If attackTime is positive, and less than the total duration, then the dampTime is the total duration after the attackTime, otherwise, the attackTime and dampTime are both set to half the duration.

Parameters:
duration - duration of the entire damp envelope

sampleRateChanged

protected void sampleRateChanged()
Description copied from class: UGen
Override this method in your derived class to receive a notification when the sample rate of your UGen has changed. You might need to do this to recalculate sample rate dependent values, such as the step size for an oscillator.

Overrides:
sampleRateChanged in class UGen

unpatchAfterDamp

public void unpatchAfterDamp(AudioOutput output)
Tell the Damp that it should unpatch itself from the output after the release time.

Parameters:
output - AudioOutput for this Damp

uGenerate

protected void uGenerate(float[] channels)
Description copied from class: UGen
Implement this method when you extend UGen. It will be called when your UGen needs to generate one sample frame of audio. It is expected that you will assign values to the array and not simply modify the existing values. In the case where you write a UGen that takes audio input and modifies it, the pattern to follow is to have the first UGenInput you create be your audio input and then in uGenerate you will use the getLastValues method of your audio UGenInput to retrieve the audio you want to modify, which you will then modify however you need to, assigning the result to the values in channels.

Specified by:
uGenerate in class UGen
Parameters:
channels - an array representing one sample frame.