com.groovemanager.sampled.fx
Class Flanger

java.lang.Object
  extended by com.groovemanager.sampled.fx.AbstractEffect
      extended by com.groovemanager.sampled.fx.Flanger
All Implemented Interfaces:
Effect

public class Flanger
extends AbstractEffect

A Chorus/Flanger Effect. The processing code is derived from the one given in the book "Digital Audio with Java" by Craig A. Lindley.

Author:
Manu Robledo

Field Summary
private  BypassControl bypassControl
           
private  float[][] delayBuffer
           
private  int delayBufferSize
           
private  DelayTimeControl delayControl
           
private  DryWetControl dryWetControl
           
private  FeedbackControl feedbackControl
           
private  InvertFeedbackControl invertControl
           
private  LFODepthControl lfoDepthControl
           
private  LFOFrequencyControl lfoFreqControl
           
private  int readIndex
           
private  int sampleNumber
           
private  double step
           
private  double sweepValue
           
private  LFOWaveFormControl waveFormControl
           
private  int writeIndex
           
 
Fields inherited from class com.groovemanager.sampled.fx.AbstractEffect
sampleRate
 
Constructor Summary
Flanger()
           
 
Method Summary
 javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type type)
          Get a Control of the desired type from this effect
 javax.sound.sampled.Control[] getControls()
          Get the set of Controls for manipulation of this effect´s parameters
 boolean isControlSupported(javax.sound.sampled.Control.Type type)
          Ask this effect, if it supports a Control of the given type
 boolean isUndoable()
          Ask this Effect, if it can provide an Undo-Effect
 void open(float sampleRate)
          Start the effect processing with the given sample rate.
 void process(java.nio.FloatBuffer[] in, java.nio.FloatBuffer[] out)
          Process a buffer of audio data.
 Effect undoEffect()
          If undo is supported, this method should return an Effect that can bring the processed audio data into the state it had before processing by applying it to the processed audio data.
 
Methods inherited from class com.groovemanager.sampled.fx.AbstractEffect
analyze, close, getName, isAnalyzing, isOpen, needsAnalysis, startAnalysis, stopAnalysis
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bypassControl

private BypassControl bypassControl

delayBuffer

private float[][] delayBuffer

delayBufferSize

private int delayBufferSize

delayControl

private DelayTimeControl delayControl

dryWetControl

private DryWetControl dryWetControl

feedbackControl

private FeedbackControl feedbackControl

invertControl

private InvertFeedbackControl invertControl

lfoDepthControl

private LFODepthControl lfoDepthControl

lfoFreqControl

private LFOFrequencyControl lfoFreqControl

readIndex

private int readIndex

sampleNumber

private int sampleNumber

step

private double step

sweepValue

private double sweepValue

waveFormControl

private LFOWaveFormControl waveFormControl

writeIndex

private int writeIndex
Constructor Detail

Flanger

public Flanger()
Method Detail

getControl

public javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type type)
Description copied from interface: Effect
Get a Control of the desired type from this effect

Specified by:
getControl in interface Effect
Specified by:
getControl in class AbstractEffect
Parameters:
type - The type of the Control
Returns:
The Control of the specified type, if the effect supports such a Control. Otherwise null.
See Also:
Effect.getControl(javax.sound.sampled.Control.Type)

getControls

public javax.sound.sampled.Control[] getControls()
Description copied from interface: Effect
Get the set of Controls for manipulation of this effect´s parameters

Specified by:
getControls in interface Effect
Specified by:
getControls in class AbstractEffect
Returns:
An Array of Control instances for the manipualtion of this effect´s attributes.
See Also:
Effect.getControls()

isControlSupported

public boolean isControlSupported(javax.sound.sampled.Control.Type type)
Description copied from interface: Effect
Ask this effect, if it supports a Control of the given type

Specified by:
isControlSupported in interface Effect
Specified by:
isControlSupported in class AbstractEffect
Parameters:
type - The type of Control to ask for
Returns:
true, if this type of control is supported by this effect, false otherwise
See Also:
Effect.isControlSupported(javax.sound.sampled.Control.Type)

isUndoable

public boolean isUndoable()
Description copied from interface: Effect
Ask this Effect, if it can provide an Undo-Effect

Specified by:
isUndoable in interface Effect
Specified by:
isUndoable in class AbstractEffect
Returns:
true, if undo is supported and a call to undoEffect() will return a valid Undo-Effect, false otherwise
See Also:
Effect.isUndoable()

open

public void open(float sampleRate)
Description copied from interface: Effect
Start the effect processing with the given sample rate. A call to this method will usually be followed by a number of calls to process() and not necessarily by a final call to close(). An Effect instance can be opened, closed and re-opened unlimited times.

Specified by:
open in interface Effect
Overrides:
open in class AbstractEffect
Parameters:
sampleRate - The samplerate of the audio data to process
See Also:
Effect.open(float)

process

public void process(java.nio.FloatBuffer[] in,
                    java.nio.FloatBuffer[] out)
Description copied from interface: Effect
Process a buffer of audio data. This method is the heart of the Effect. In it the processing will be done. The given buffers will all be rewinded and have the same number of floats remaining, so that any one of the buffers can be used for iteration. The Arrays are always of size 2 with the left channel´s data at index [0] and the right channel at index [1]. The in-buffers contain the audio data before processing and the out-buffers should contain the processed data after the return of this method. All audio data is normalized to floats with a maximum of +/- 1.0. Anyway it may happen, that some values are greater than 1.0 or less than -1.0 because a previous Effect in the chain has exceeded the maximum amplitude. This is no problem. No clipping will occur until the end of the processing chain has been reached. This should then be done by the application so that each Effect doesn´t have to worry about exceeding the maximum amplitude.

Specified by:
process in interface Effect
Specified by:
process in class AbstractEffect
Parameters:
in - Array of two FloatBuffers containing the audio data to be processed for the left (index [0]) and the right (index [1]) channel.
out - Array of two FloatBuffers into which the processed audio data should be written during this method.
See Also:
Effect.process(java.nio.FloatBuffer[], java.nio.FloatBuffer[])

undoEffect

public Effect undoEffect()
Description copied from interface: Effect
If undo is supported, this method should return an Effect that can bring the processed audio data into the state it had before processing by applying it to the processed audio data.

Specified by:
undoEffect in interface Effect
Specified by:
undoEffect in class AbstractEffect
Returns:
An Effect that is the exact undo-Effect of this Effect.
See Also:
Effect.undoEffect()