toxi.math.waves
Class SineWave

java.lang.Object
  extended by toxi.math.waves.AbstractWave
      extended by toxi.math.waves.SineWave

public class SineWave
extends AbstractWave

Standard Sine wave at fixed frequency and values normalized to the given amplitude.


Field Summary
 
Fields inherited from class toxi.math.waves.AbstractWave
amp, frequency, offset, phase, PI, TWO_PI, value
 
Constructor Summary
SineWave()
           
SineWave(float phase, float freq)
           
SineWave(float phase, float freq, float amp, float offset)
           
 
Method Summary
 float update()
          Updates the wave and returns new value.
 
Methods inherited from class toxi.math.waves.AbstractWave
cyclePhase, cyclePhase, hertzToRadians, pop, push, radiansToHertz, reset, setPhase, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SineWave

public SineWave()

SineWave

public SineWave(float phase,
                float freq)
Parameters:
phase - starting phase
freq - in radians (not Hertz)

SineWave

public SineWave(float phase,
                float freq,
                float amp,
                float offset)
Parameters:
phase - starting phase
freq - in radians (not Hertz)
amp - amplitude factor
offset - centre oscillation value
Method Detail

update

public float update()
Description copied from class: AbstractWave
Updates the wave and returns new value. Implementing classes should manually ensure the phase remains in the 0...TWO_PI interval or by calling AbstractWave.cyclePhase().

Specified by:
update in class AbstractWave
Returns:
current (newly calculated) wave value