ddf.minim
Class EffectsChain

java.lang.Object
  extended by ddf.minim.EffectsChain
All Implemented Interfaces:
AudioEffect

public class EffectsChain
extends java.lang.Object
implements AudioEffect

An EffectsChain is a list of AudioEffects that gives you the ability to enable and disable effects, as you would in a typical DAW. When you add an effect, it is added to the end of the chain and is enabled. When you remove an effect, effects further down the chain are moved up a slot. EffectsChain is itself an AudioEffect, so you can easily create groups of effects that can be enabled/disabled together by putting them in an EffectsChain and then adding that chain to an Effectable as a single effect. EffectsChain is fully synchronized so that it is not possible to add and remove effects while processing is taking place.

Author:
Damien Di Fede

Constructor Summary
EffectsChain()
          Constructs an empty EffectsChain.
 
Method Summary
 void add(AudioEffect e)
          Adds e to the end of the chain.
 void clear()
          Removes all effects from the effect chain.
 boolean contains(AudioEffect e)
          Returns true if e is in this chain
 void disable(AudioEffect e)
          Disables e if it is in the chain.
 void disable(int i)
          Disables the ith effect in the chain.
 void disableAll()
          Disables all effects in the chain.
 void enable(AudioEffect e)
          Enables e if it is in the chain.
 void enable(int i)
          Enables the ith effect in the chain.
 void enableAll()
          Enables all effects in the chain.
 AudioEffect get(int i)
          Gets the ith effect in the chain.
 boolean hasEnabled()
          Returns true if at least one effect in the chain is enabled.
 boolean isEnabled(AudioEffect e)
          Returns true if e is in the chain and is enabled.
 void process(float[] samp)
          Sends samp to each effect in the chain, in order.
 void process(float[] sampL, float[] sampR)
          Sends sampL and sampR to each effect in the chain, in order.
 void remove(AudioEffect e)
          Removes e from the chain.
 AudioEffect remove(int i)
          Removes and returns the ith effect from the chain.
 int size()
          Returns the number of effects in the chain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EffectsChain

public EffectsChain()
Constructs an empty EffectsChain.

Method Detail

add

public void add(AudioEffect e)
Adds e to the end of the chain.

Parameters:
e - the AudioEffect to add

remove

public void remove(AudioEffect e)
Removes e from the chain.

Parameters:
e - the AudioEffect to remove

remove

public AudioEffect remove(int i)
Removes and returns the ith effect from the chain.

Parameters:
i - the index of the AudioEffect to remove
Returns:
the AudioEffect that was removed

get

public AudioEffect get(int i)
Gets the ith effect in the chain.

Parameters:
i - the index of the AudioEffect to get

contains

public boolean contains(AudioEffect e)
Returns true if e is in this chain

Parameters:
e - the AudioEffect to check for
Returns:
true if e is in this chain

enable

public void enable(int i)
Enables the ith effect in the chain.

Parameters:
i - the index of the effect to enable

enable

public void enable(AudioEffect e)
Enables e if it is in the chain.

Parameters:
e - the AudioEffect to enable

enableAll

public void enableAll()
Enables all effects in the chain.


hasEnabled

public boolean hasEnabled()
Returns true if at least one effect in the chain is enabled.

Returns:
true if at least one effect in the chain is enabled

isEnabled

public boolean isEnabled(AudioEffect e)
Returns true if e is in the chain and is enabled.

Parameters:
e - the AudioEffect to return the status of
Returns:
true if e is enabled and in the chain

disable

public void disable(int i)
Disables the ith effect in the chain.

Parameters:
i - the index of the effect to disable

disable

public void disable(AudioEffect e)
Disables e if it is in the chain.

Parameters:
e - the AudioEffect to disable

disableAll

public void disableAll()
Disables all effects in the chain.


size

public int size()
Returns the number of effects in the chain.

Returns:
the number of effects in the chain

clear

public void clear()
Removes all effects from the effect chain.


process

public void process(float[] samp)
Sends samp to each effect in the chain, in order.

Specified by:
process in interface AudioEffect
Parameters:
samp - the samples to process

process

public void process(float[] sampL,
                    float[] sampR)
Sends sampL and sampR to each effect in the chain, in order. The two float arrays should correspond to the left and right channels of a stereo signal.

Specified by:
process in interface AudioEffect
Parameters:
sampL - the left channel of the signal to process
sampR - the right channel of the signal to process