jass.generators
Class Sine

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

public class Sine
extends Out

Output sine wave. (Highly inefficient implementation.)

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

Field Summary
protected  float freq
          Freq.
protected  float phase
          Current phase
 float srate
          Sampling rate in Hertz of Out.
static float TWOPI
           
protected  float volume
          Amplitude or volume of sine
 
Fields inherited from class jass.engine.Out
buf, bufferSize, bufOld, lock
 
Constructor Summary
Sine(float srate, int bufferSize)
           
 
Method Summary
protected  void computeBuffer()
          Compute the next buffer and store in member float[] buf.
 void setFrequency(float f)
          Set frequency
 void setVolume(float val)
          Set amplitude
 
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

srate

public float srate
Sampling rate in Hertz of Out.


volume

protected float volume
Amplitude or volume of sine


phase

protected float phase
Current phase


freq

protected float freq
Freq. in Hertz


TWOPI

public static final float TWOPI
See Also:
Constant Field Values
Constructor Detail

Sine

public Sine(float srate,
            int bufferSize)
Method Detail

setVolume

public void setVolume(float val)
Set amplitude

Parameters:
val - Volume.

setFrequency

public void setFrequency(float f)
Set frequency

Parameters:
f - frequency.

computeBuffer

protected void computeBuffer()
Description copied from class: Out
Compute the next buffer and store in member float[] buf. This is the core processing method which will be implemented for each generator.

Specified by:
computeBuffer in class Out