jass.generators
Class ErraticLoopBuffer

java.lang.Object
  extended by jass.engine.Out
      extended by jass.generators.LoopBuffer
          extended by jass.generators.ErraticLoopBuffer
All Implemented Interfaces:
Source

public class ErraticLoopBuffer
extends LoopBuffer

A force model based on looping through a buffer, loaded from an audio file or provided by caller. Adds a probablility to "misfire", i.e., skip a section of the loop.

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

Field Summary
 
Fields inherited from class jass.generators.LoopBuffer
dix, dx, ix, loopBuffer, loopBufferLength, speed, srate, srateLoopBuffer, volume, x
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
ErraticLoopBuffer(float srate, int bufferSize, float[] loopBuffer)
          Construct loop force and provide buffer
ErraticLoopBuffer(float srate, int bufferSize, java.lang.String fn)
          Construct loop force from named file.
ErraticLoopBuffer(float srate, int bufferSize, java.net.URL url)
          Construct loop force from url
ErraticLoopBuffer(int bufferSize)
          For derived classes
 
Method Summary
 void computeBuffer()
          Compute the next buffer.
 float getMisfireProb()
          Get probability of misfiring per call to computeBuffer
 void setMisfireProb(float val)
          Set probability of misfiring per call to computeBuffer
 
Methods inherited from class jass.generators.LoopBuffer
getLoopBuffer, getNextSample, setSpeed, setVolume
 
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
 

Constructor Detail

ErraticLoopBuffer

public ErraticLoopBuffer(int bufferSize)
For derived classes

Parameters:
bufferSize - biffer size

ErraticLoopBuffer

public ErraticLoopBuffer(float srate,
                         int bufferSize,
                         java.lang.String fn)
Construct loop force from named file.

Parameters:
srate - sampling rate in Hertz.
bufferSize - bufferSize of this Out
fn - Audio file name.

ErraticLoopBuffer

public ErraticLoopBuffer(float srate,
                         int bufferSize,
                         java.net.URL url)
Construct loop force from url

Parameters:
srate - sampling rate in Hertz.
bufferSize - bufferSize of this Out
url - Audio file url.

ErraticLoopBuffer

public ErraticLoopBuffer(float srate,
                         int bufferSize,
                         float[] loopBuffer)
Construct loop force and provide buffer

Parameters:
srate - sampling rate in Hertz.
bufferSize - bufferSize of this Out.
loopBuffer - looping buffer.
Method Detail

setMisfireProb

public void setMisfireProb(float val)
Set probability of misfiring per call to computeBuffer

Parameters:
val - probability.

getMisfireProb

public float getMisfireProb()
Get probability of misfiring per call to computeBuffer

Returns:
probability.

computeBuffer

public void computeBuffer()
Compute the next buffer. Skip 1/2 loop with probability misfireProb.

Overrides:
computeBuffer in class LoopBuffer