jass.generators
Class ResonFilter

java.lang.Object
  extended by jass.generators.ResonFilter
All Implemented Interfaces:
Filter

public class ResonFilter
extends java.lang.Object
implements Filter

Reson filter.

Author:
Kees van den Doel (kvdoel@cs.ubc.ca)

Field Summary
protected  float srate
          Sampling rate in Hertz.
 
Constructor Summary
ResonFilter(float srate)
          Create and initialize.
 
Method Summary
 void filter(float[] output, float[] input, int nsamples, int inputOffset)
          Proces input (may be same as output).
 float filter1Sample(float input)
          Proces a single sample.
 void reset()
          Reset state.
 void setGain(float a)
          Set gain.
 void setResonCoeff(float f, float d, float a)
          Set the reson coefficients and gain.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

srate

protected float srate
Sampling rate in Hertz.

Constructor Detail

ResonFilter

public ResonFilter(float srate)
Create and initialize.

Parameters:
srate - sampling rate in Hertz.
Method Detail

setResonCoeff

public void setResonCoeff(float f,
                          float d,
                          float a)
Set the reson coefficients and gain. Cache c_i.

Parameters:
f - resonance frequency in Hertz.
d - damping in radians/s.
a - gain.

setGain

public void setGain(float a)
Set gain.

Parameters:
a - gain.

reset

public void reset()
Reset state.


filter

public void filter(float[] output,
                   float[] input,
                   int nsamples,
                   int inputOffset)
Proces input (may be same as output).

Specified by:
filter in interface Filter
Parameters:
output - user provided buffer for returned result.
input - user provided input buffer.
nsamples - number of samples written to output buffer.
inputOffset - where to start in circular buffer input.

filter1Sample

public float filter1Sample(float input)
Proces a single sample. Use thgis to use ResonFilter in stand-alone mode (i.e., not in a patch.

Parameters:
input - user provided input sample
Returns:
returned result.