jass.generators
Class QuenchableModalObjectWithOneContact
java.lang.Object
jass.engine.Out
jass.engine.InOut
jass.generators.ModalObjectWithOneContact
jass.generators.QuenchableModalObjectWithOneContact
- All Implemented Interfaces:
- Sink, Source
public class QuenchableModalObjectWithOneContact
- extends ModalObjectWithOneContact
Vibration model of object, capable of playing sound.
Extended to keep track of current excitation and capable of modes being turned
on/off.
- Author:
- Kees van den Doel (kvdoel@cs.ubc.ca)
Field Summary |
protected boolean[] |
onBit
True for the modes that are on |
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 |
Method Summary |
protected void |
computeModalFilterBank(float[] output,
float[] force,
int nsamples)
Apply external force[] and compute response through bank of modal filters. |
float |
getModeExcitation(int k)
Return current excitation of mode. |
void |
setOnBit(int mode,
boolean on)
Turn mode on/off. |
Methods inherited from class jass.generators.ModalObjectWithOneContact |
addSource, allocate, clearHistory, computeBuffer, computeFilter, computeLocation, computeResonCoeff, setDamping, setFrequencyScale, setGain, setLocation, setNf |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
onBit
protected boolean[] onBit
- True for the modes that are on
QuenchableModalObjectWithOneContact
public QuenchableModalObjectWithOneContact(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.
QuenchableModalObjectWithOneContact
public QuenchableModalObjectWithOneContact(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.
setOnBit
public void setOnBit(int mode,
boolean on)
- Turn mode on/off.
- Parameters:
mode
- mode numberon
- true if turn on, fals if turn off
getModeExcitation
public float getModeExcitation(int k)
- Return current excitation of mode. Approximated as (y(t)^2 + (dy/dt)^2/(2pif)^2)/2).
A pulse excitation of strength x should produce excitation of (ax)^2/2, with "a"
gain of mode.
- Parameters:
k
- mode number
- Returns:
- excitation
computeModalFilterBank
protected void computeModalFilterBank(float[] output,
float[] force,
int nsamples)
- Apply external force[] and compute response through bank of modal filters.
As in super class but skip off modes.
- Overrides:
computeModalFilterBank
in class ModalObjectWithOneContact
- Parameters:
output
- user provided output buffer.force
- input force.nsamples
- number of samples to compute.