jass.generators
Class ModalObjectWithOneContactInterpolated

java.lang.Object
  extended by jass.engine.Out
      extended by jass.engine.InOut
          extended by jass.generators.ModalObjectWithOneContact
              extended by jass.generators.ModalObjectWithOneContactInterpolated
All Implemented Interfaces:
Sink, Source
Direct Known Subclasses:
ColorSonificator

public class ModalObjectWithOneContactInterpolated
extends ModalObjectWithOneContact

Vibration model of object, capable of playing sound. Changes in freq damping and gains are linearly changed over one buffer rather than abruptly

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

Field Summary
protected  float[] ampR_new
          Reson filter gain.
protected  float[] R2_new
          The transfer function of a reson filter is H(z) = 1/(1-twoRCosTheta/z + R2/z*z).
protected  float[] twoRCosTheta_new
           
 
Fields inherited from class jass.generators.ModalObjectWithOneContact
ampR, b1, b2, b3, c_i, modalModel, p1, p2, p3, R2, rollGain, srate, tmpBuf, twoRCosTheta, yt_1, yt_2
 
Fields inherited from class jass.engine.InOut
sourceContainer, sourcePassivity, srcBuffers
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
ModalObjectWithOneContactInterpolated(float srate, int nf, int np, int bufferSize)
          Create and initialize, but don't set any modal parameters.
ModalObjectWithOneContactInterpolated(int bufferSize)
          Constructor for derived classes to call super
ModalObjectWithOneContactInterpolated(ModalModel m, float srate, int bufferSize)
          Create and initialize with provided modal data.
 
Method Summary
protected  void allocate_new(int nf, int np)
          Allocate data for new filter values
protected  void computeLocation()
          Compute gains.
protected  void computeModalFilterBank(float[] output, float[] force, int nsamples)
          Apply external force[] and compute response through bank of modal filters.
 void computeResonCoeff()
          Compute the reson coefficients from the modal model parameters.
 
Methods inherited from class jass.generators.ModalObjectWithOneContact
addSource, allocate, clearHistory, computeBuffer, computeFilter, setDamping, setFrequencyScale, setGain, setLocation, setNf
 
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

R2_new

protected float[] R2_new
The transfer function of a reson filter is H(z) = 1/(1-twoRCosTheta/z + R2/z*z).


twoRCosTheta_new

protected float[] twoRCosTheta_new

ampR_new

protected float[] ampR_new
Reson filter gain.

Constructor Detail

ModalObjectWithOneContactInterpolated

public ModalObjectWithOneContactInterpolated(int bufferSize)
Constructor for derived classes to call super

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

ModalObjectWithOneContactInterpolated

public ModalObjectWithOneContactInterpolated(float srate,
                                             int nf,
                                             int np,
                                             int bufferSize)
Create and initialize, but don't set any modal parameters.

Parameters:
srate - sampling rate in Hertz.
nf - number of modes.
np - number of locations.
bufferSize - Buffer size used for real-time rendering.

ModalObjectWithOneContactInterpolated

public ModalObjectWithOneContactInterpolated(ModalModel m,
                                             float srate,
                                             int bufferSize)
Create and initialize with provided modal data.

Parameters:
m - modal model to load.
srate - sampling rate in Hertz.
bufferSize - Buffer size used for real-time rendering.
Method Detail

allocate_new

protected void allocate_new(int nf,
                            int np)
Allocate data for new filter values

Parameters:
nf - number of modes.
np - number of locations.

computeResonCoeff

public void computeResonCoeff()
Compute the reson coefficients from the modal model parameters. Cache values used in ModalObjectWithOneContact.setLocation(int, int, int, float, float, float).

Overrides:
computeResonCoeff in class ModalObjectWithOneContact

computeLocation

protected void computeLocation()
Compute gains. Check also if any frequency is above Nyquist rate. If so set its gain to zero.

Overrides:
computeLocation in class ModalObjectWithOneContact

computeModalFilterBank

protected void computeModalFilterBank(float[] output,
                                      float[] force,
                                      int nsamples)
Apply external force[] and compute response through bank of modal filters. Interpolate filter parameters over the buffer. c[k]=k*(c_new-c_old)/nsamples + c_old

Overrides:
computeModalFilterBank in class ModalObjectWithOneContact
Parameters:
output - user provided output buffer.
force - input force.
nsamples - number of samples to compute.