jass.generators
Class OneShotBuffer

java.lang.Object
  extended by jass.engine.Out
      extended by jass.generators.LoopBuffer
          extended by jass.generators.OneShotBuffer
All Implemented Interfaces:
Source
Direct Known Subclasses:
BangForce

public class OneShotBuffer
extends LoopBuffer

A force model based on looping through a buffer once, loaded from an audio file or provided by caller.

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
OneShotBuffer(float srate, int bufferSize, float[] loopBuffer)
          Construct loop force and provide buffer.
OneShotBuffer(float srate, int bufferSize, java.lang.String fn)
          Construct loop force from named file.
 
Method Summary
 void computeBuffer()
          Compute the next buffer.
 void hit()
          Calling this method will cause next call to getBuffer() to start playback of the buffer.
 
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

OneShotBuffer

public OneShotBuffer(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.

OneShotBuffer

public OneShotBuffer(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

hit

public void hit()
Calling this method will cause next call to getBuffer() to start playback of the buffer.


computeBuffer

public void computeBuffer()
Compute the next buffer. If not hit return zero.

Overrides:
computeBuffer in class LoopBuffer