jass.generators
Class Delay

java.lang.Object
  extended by jass.engine.Out
      extended by jass.engine.InOut
          extended by jass.engine.FilterUG
              extended by jass.generators.Delay
All Implemented Interfaces:
Sink, Source

public class Delay
extends FilterUG

Delay line. H(z) = z^_{L} y(t) = x(t-L)

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

Field Summary
protected  float[] cbuf
           
protected  int cbuf_head
           
protected  int rawDelay
           
protected  float srate
           
 
Fields inherited from class jass.engine.InOut
sourceContainer, sourcePassivity, srcBuffers
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
Delay(int bufferSize)
          Create.
Delay(int bufferSize, float srate)
          Create and initialize.
 
Method Summary
protected  void computeBuffer()
          Compute the next buffer and store in member float[] buf.
 float getRawDelay()
          Get raw delay.
 float getRecursiveDelay()
          Get recursive delay.
protected  void init()
          Init and allocate.
 void setRawDelay(float del)
          Set raw delay.
 void setRecursiveDelay(float del)
          Set recursive delay.
 
Methods inherited from class jass.engine.FilterUG
addSource
 
Methods inherited from class jass.engine.InOut
addSource, getBuffer, getSources, removeSource, resetTime
 
Methods inherited from class jass.engine.Out
clearBuffer, copyToOld, getBuffer, getBufferSize, getTime, peekAtBuffer, setBufferSize, setTime, setTimeAndNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

srate

protected float srate

rawDelay

protected int rawDelay

cbuf

protected float[] cbuf

cbuf_head

protected int cbuf_head
Constructor Detail

Delay

public Delay(int bufferSize,
             float srate)
Create and initialize.

Parameters:
bufferSize - Buffer size used for real-time rendering.
srate - sampling rate in Hertz.

Delay

public Delay(int bufferSize)
Create. For derived classes.

Parameters:
bufferSize - Buffer size used for real-time rendering.
Method Detail

init

protected void init()
Init and allocate.


setRawDelay

public void setRawDelay(float del)
Set raw delay. This does not take the additional delay in closed loops into account. Also allocates buffers and inits the state.

Parameters:
del - delay in seconds

getRawDelay

public float getRawDelay()
Get raw delay. This does not take the additional delay in closed loops into account.

Returns:
raw delay in seconds

setRecursiveDelay

public void setRecursiveDelay(float del)
                       throws java.lang.IllegalArgumentException
Set recursive delay. This does take the additional delay in closed loops into account. Delay can not be smaller than the bufferSize. Also allocates buffers and inits the state.

Parameters:
del - delay in seconds.
Throws:
java.lang.IllegalArgumentException

getRecursiveDelay

public float getRecursiveDelay()
Get recursive delay. This does take the additional delay in closed loops into account. Delay can not be smaller than the bufferSize.

Returns:
delay in seconds.

computeBuffer

protected void computeBuffer()
Compute the next buffer and store in member float[] buf. Insert srcBuffers[0][] into queue at head and move head forward. Then copy new head into buf[]

Specified by:
computeBuffer in class Out