com.groovemanager.sampled.fx
Class SimpleEcho

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

public class SimpleEcho
extends java.lang.Object
implements Effect

A dummy implementation of a delay Effect. The delay time depends on the buffer size...

Author:
Manu Robledo

Field Summary
(package private)  EchoAmountControl amountControl
          The Control for controlling the intensity of the echo
(package private)  float[] left
          Temporary variables
(package private)  float[] left2
          Temporary variables
(package private)  boolean open
          Indicates whether this Effect is currently open or not
(package private)  float[] right
          Temporary variables
(package private)  float[] right2
          Temporary variables
(package private)  float[] temp
          Temporary variables
 
Constructor Summary
SimpleEcho()
           
 
Method Summary
 void analyze(java.nio.FloatBuffer[] in)
          Analyze a buffer of audio data
 void close()
          Close this Effect.
 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
 java.lang.String getName()
          Get the name of this Effect
 boolean isAnalyzing()
          Indicates whether this Effect is currently expecting calls to analyze() or not.
 boolean isControlSupported(javax.sound.sampled.Control.Type type)
          Ask this effect, if it supports a Control of the given type
 boolean isOpen()
          Indicate, whether this effect is open and therefore ready for processing or not.
 boolean isUndoable()
          Ask this Effect, if it can provide an Undo-Effect
 boolean needsAnalysis()
          Ask this Effect, if it needs to analyze the whole audio data before being able to process it
 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.
 void startAnalysis(float sampleRate)
          If this Effects needs to analyze the whole audio data before processing, an analyzation will be done before the processing.
 void stopAnalysis()
          Indicate that the analyzation process has been finished and no more calls to analyze() are to be expected before the next call to startAnalysis().
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

amountControl

EchoAmountControl amountControl
The Control for controlling the intensity of the echo


left

float[] left
Temporary variables


left2

float[] left2
Temporary variables


open

boolean open
Indicates whether this Effect is currently open or not


right

float[] right
Temporary variables


right2

float[] right2
Temporary variables


temp

float[] temp
Temporary variables

Constructor Detail

SimpleEcho

public SimpleEcho()
Method Detail

analyze

public void analyze(java.nio.FloatBuffer[] in)
Description copied from interface: Effect
Analyze a buffer of audio data

Specified by:
analyze in interface Effect
Parameters:
in - Array of two FloatBuffers containing the audio data to be analyzed for the left (index [0]) and the right (index [1]) channel.
See Also:
Effect.analyze(java.nio.FloatBuffer[])

close

public void close()
Description copied from interface: Effect
Close this Effect. A call to this method is optional and will only tell the Effect, that no further calls to process() are to be expected before the next call to open()

Specified by:
close in interface Effect
See Also:
Effect.close()

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
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
Returns:
An Array of Control instances for the manipualtion of this effect´s attributes.
See Also:
Effect.getControls()

getName

public java.lang.String getName()
Description copied from interface: Effect
Get the name of this Effect

Specified by:
getName in interface Effect
Returns:
This effect´s name
See Also:
Effect.getName()

isAnalyzing

public boolean isAnalyzing()
Description copied from interface: Effect
Indicates whether this Effect is currently expecting calls to analyze() or not.

Specified by:
isAnalyzing in interface Effect
Returns:
true, if this Effect is currently in analyzing state, false otherwise
See Also:
Effect.isAnalyzing()

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
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)

isOpen

public boolean isOpen()
Description copied from interface: Effect
Indicate, whether this effect is open and therefore ready for processing or not.

Specified by:
isOpen in interface Effect
Returns:
true, if the Effect is open, false otherwise.
See Also:
Effect.isOpen()

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
Returns:
true, if undo is supported and a call to undoEffect() will return a valid Undo-Effect, false otherwise
See Also:
Effect.isUndoable()

needsAnalysis

public boolean needsAnalysis()
Description copied from interface: Effect
Ask this Effect, if it needs to analyze the whole audio data before being able to process it

Specified by:
needsAnalysis in interface Effect
Returns:
true, if anayzation is needed by this Effect, false otherwise
See Also:
Effect.needsAnalysis()

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
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
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[])

startAnalysis

public void startAnalysis(float sampleRate)
Description copied from interface: Effect
If this Effects needs to analyze the whole audio data before processing, an analyzation will be done before the processing. This method will be called to indicate that analyzation starts and will usually be followed by a number of calls to analyze() and an optional final call to stopAnalysis(). After finishing analyzation open() to start processing. so an analyzing Effect is not necessarily open.

Specified by:
startAnalysis in interface Effect
Parameters:
sampleRate - The sample rate of the audio data to be analyzed
See Also:
Effect.startAnalysis(float)

stopAnalysis

public void stopAnalysis()
Description copied from interface: Effect
Indicate that the analyzation process has been finished and no more calls to analyze() are to be expected before the next call to startAnalysis(). This method is optional.

Specified by:
stopAnalysis in interface Effect
See Also:
Effect.stopAnalysis()

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
Returns:
An Effect that is the exact undo-Effect of this Effect.
See Also:
Effect.undoEffect()