jass.contact
Class ContactForce

java.lang.Object
  extended by jass.engine.Out
      extended by jass.contact.ContactForce
All Implemented Interfaces:
Source
Direct Known Subclasses:
ARContactForce

public class ContactForce
extends Out

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

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

Field Summary
protected  BangForce bangForce
           
protected  float dryRollGain
           
protected  float fLowPass
           
protected  Butter2LowFilter lowPassFilter
           
protected  float physicalToAudioGainImpact
           
protected  float physicalToAudioGainRoll
           
protected  float physicalToAudioGainSlide
           
protected  FilterContainer 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
  ContactForce(float srate, int bufferSize, java.lang.String fnImpact, java.lang.String fnSlide, java.lang.String fnRoll)
          Construct contact force from named files.
protected ContactForce(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 setRollFilter(float fLowPass, float dryRollGain)
          Set roll force filter properties: cutoff and drygain.
 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 FilterContainer rollForce

lowPassFilter

protected Butter2LowFilter lowPassFilter

fLowPass

protected float fLowPass

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

ContactForce

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


ContactForce

public ContactForce(float srate,
                    int bufferSize,
                    java.lang.String fnImpact,
                    java.lang.String fnSlide,
                    java.lang.String fnRoll)
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.)
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 fLowPass,
                          float dryRollGain)
Set roll force filter properties: cutoff and drygain.


computeBuffer

public void computeBuffer()
Compute the next buffer.

Specified by:
computeBuffer in class Out