|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.math.waves.AbstractWave
public abstract class AbstractWave
Abstract wave oscillator type which needs to be subclassed to implement
different waveforms. Please note that the frequency unit is radians, but
conversion methods to & from Hertz (hertzToRadians(float, float)
)
are included in this base class.
Field Summary | |
---|---|
float |
amp
|
float |
frequency
|
float |
offset
|
float |
phase
Current wave phase |
static float |
PI
|
static float |
TWO_PI
|
float |
value
|
Constructor Summary | |
---|---|
AbstractWave()
|
|
AbstractWave(float phase)
|
|
AbstractWave(float phase,
float freq)
|
|
AbstractWave(float phase,
float freq,
float amp,
float offset)
|
Method Summary | |
---|---|
float |
cyclePhase()
Ensures phase remains in the 0...TWO_PI interval. |
float |
cyclePhase(float freq)
Progresses phase and ensures it remains in the 0...TWO_PI interval. |
static float |
hertzToRadians(float hz,
float sampleRate)
Converts a frequency in Hertz into radians. |
void |
pop()
|
void |
push()
|
static float |
radiansToHertz(float f,
float sampleRate)
Converts a frequency from radians to Hertz. |
void |
reset()
Resets the wave phase to the last set phase value (via setPhase(float) . |
void |
setPhase(float phase)
Starts the wave from a new phase. |
java.lang.String |
toString()
|
abstract float |
update()
Updates the wave and returns new value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final float PI
public static final float TWO_PI
public float phase
public float frequency
public float amp
public float offset
public float value
Constructor Detail |
---|
public AbstractWave()
public AbstractWave(float phase)
phase
- public AbstractWave(float phase, float freq)
phase
- freq
- public AbstractWave(float phase, float freq, float amp, float offset)
phase
- freq
- amp
- offset
- Method Detail |
---|
public static final float hertzToRadians(float hz, float sampleRate)
hz
- frequency to convert (in Hz)sampleRate
- sampling rate in Hz (equals period length @ 1 Hz)
public static final float radiansToHertz(float f, float sampleRate)
f
- frequency in radianssampleRate
- sampling rate in Hz (equals period length @ 1 Hz)
public final float cyclePhase()
public final float cyclePhase(float freq)
freq
- normalized progress frequency
public void pop()
public void push()
public void reset()
setPhase(float)
.
public void setPhase(float phase)
reset()
phase
- new phasepublic java.lang.String toString()
toString
in class java.lang.Object
public abstract float update()
cyclePhase()
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |