jass.contact
Class ContactForce2

java.lang.Object
  extended by jass.engine.Out
      extended by jass.contact.ContactForce2
All Implemented Interfaces:
Source

public class ContactForce2
extends Out

A force model with impact, slide, and slide modes based on looping wav files Roll force is fed through modal filter.

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

Field Summary
protected  BangForce bangForce
           
protected  float dryRollGain
           
protected  float physicalToAudioGainImpact
           
protected  float physicalToAudioGainRoll
           
protected  float physicalToAudioGainSlide
           
protected  ModalObjectWithOneContact rollForce
           
protected  LoopBuffer rollForceRaw
           
protected  float rollSpeed1
           
protected  LoopBuffer slideForce
           
protected  float slideSpeed1
           
protected  float vroll0
           
protected  float vroll1
           
protected  float vslide0
           
protected  float vslide1
           
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
  ContactForce2(float srate, int bufferSize, java.lang.String fnImpact, java.lang.String fnSlide, java.lang.String fnRoll, ModalModel m)
          Construct contact force from named files.
protected ContactForce2(int bufferSize)
          Contructor intended only for subclass constructors (super(bufferSize);)
 
Method Summary
 void bang(float force, float dur)
          Generate impact force in physical units.
 void computeBuffer()
          Compute the next buffer.
 void setNf(int nf)
          Set roll force filter number of modes
 void setRollFilter(float damping, float dryRollGain)
          Set roll force filter properties
 void setRollProperties(float force, float speed)
          Set roll speed and normal force in physical units.
 void setSlideProperties(float force, float speed)
          Set slide speed and normal force in physical units.
 void setStaticContactModelParameters(float slideSpeed1, float rollSpeed1, float vslide0, float vslide1, float vroll0, float vroll1, float physicalToAudioGainSlide, float physicalToAudioGainRoll, float physicalToAudioGainImpact)
          Set model parameters mapping physical units to audio units
 
Methods inherited from class jass.engine.Out
clearBuffer, copyToOld, getBuffer, getBuffer, getBufferSize, getTime, peekAtBuffer, resetTime, setBufferSize, setTime, setTimeAndNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bangForce

protected BangForce bangForce

slideForce

protected LoopBuffer slideForce

rollForceRaw

protected LoopBuffer rollForceRaw

rollForce

protected ModalObjectWithOneContact rollForce

dryRollGain

protected float dryRollGain

slideSpeed1

protected float slideSpeed1

rollSpeed1

protected float rollSpeed1

vslide0

protected float vslide0

vslide1

protected float vslide1

vroll0

protected float vroll0

vroll1

protected float vroll1

physicalToAudioGainSlide

protected float physicalToAudioGainSlide

physicalToAudioGainRoll

protected float physicalToAudioGainRoll

physicalToAudioGainImpact

protected float physicalToAudioGainImpact
Constructor Detail

ContactForce2

protected ContactForce2(int bufferSize)
Contructor intended only for subclass constructors (super(bufferSize);)


ContactForce2

public ContactForce2(float srate,
                     int bufferSize,
                     java.lang.String fnImpact,
                     java.lang.String fnSlide,
                     java.lang.String fnRoll,
                     ModalModel m)
Construct contact force from named files.

Parameters:
srate - sampling rate in Hertz.
bufferSize - bufferSize of this Out.
fnImpact - audio file name for impact. (For example cos20ms.wav.)
fnSlide - audio file name for slide. (For example grid.wav.)
fnRoll - audio file name for slide. (For example roll.wav.)
m - modal model to build roll filter from.
Method Detail

setStaticContactModelParameters

public void setStaticContactModelParameters(float slideSpeed1,
                                            float rollSpeed1,
                                            float vslide0,
                                            float vslide1,
                                            float vroll0,
                                            float vroll1,
                                            float physicalToAudioGainSlide,
                                            float physicalToAudioGainRoll,
                                            float physicalToAudioGainImpact)
Set model parameters mapping physical units to audio units

Parameters:
slideSpeed1 - maximum audio loop speed (1 = original recording)
rollSpeed1 - maximum audio loop speed (1 = original recording)
vslide0 - minimum physical speed (lower than this is considered to be zero)
vslide1 - maximum physical speed (higher than this is set to this value)
vroll0 - minimum physical speed (lower than this is considered to be zero)
vroll1 - maximum physical speed (higher than this is set to this value)
physicalToAudioGainSlide - multiplies normal force to get slide gain
physicalToAudioGainRoll - multiplies normal force to get roll gain
physicalToAudioGainImpact - multiplies impact force to get impact gain

bang

public void bang(float force,
                 float dur)
Generate impact force in physical units.

Parameters:
force - magnitude.
dur - duration in seconds of impact.

setSlideProperties

public void setSlideProperties(float force,
                               float speed)
Set slide speed and normal force in physical units.

Parameters:
force - normal force.
speed - relative surface velocity.

setRollProperties

public void setRollProperties(float force,
                              float speed)
Set roll speed and normal force in physical units.

Parameters:
force - normal force.
speed - roll velocity.

setRollFilter

public void setRollFilter(float damping,
                          float dryRollGain)
Set roll force filter properties


setNf

public void setNf(int nf)
Set roll force filter number of modes

Parameters:
nf - number of modes

computeBuffer

public void computeBuffer()
Compute the next buffer.

Specified by:
computeBuffer in class Out