Package net.paulhertz.pixelaudio
Class WaveData
java.lang.Object
net.paulhertz.pixelaudio.WaveData
-
Field Summary
FieldsModifier and TypeFieldDescriptionfloat
amplitudeint
animation stepsfloat
DC offset/bias to add to generated amplitude values, a new setting, default 0static int
convenience variable, 30 seconds of animation at 24 frames per secondfloat
frequencyboolean
runtime variable for mutingfloat
fraction of TWO_PI in the range 0..1,float
number of times to cycle through TWO_PI over the duration of the animationfloat
increment to the phase for each step of animation = (cycles * TWO_PI)/(animation steps) Should be set when animation begins, otherwise is set to 0, unchanging.static final boolean
support for old JSON format where phase was already scaled by TWO_PIfloat
TWO_PI * phaseint
color associated with the wavenet.paulhertz.pixelaudio.WaveData.WaveState
tracking variable for mute, solo, etc. -
Constructor Summary
ConstructorsConstructorDescriptionWaveData()
WaveData
(float f, float a, float p, float dc, float cycles, int c) Constructor for WaveData when animation steps are not knownWaveData
(float f, float a, float p, float dc, float cycles, int c, int steps) Preferred constructor for WaveDataWaveData
(float f, float a, float p, float dc, float cycles, int c, int animSteps, boolean phaseScalesTwoPi) -
Method Summary
Modifier and TypeMethodDescriptionclone()
void
setAmp
(float a) void
setAnimationSteps
(int newSteps) void
setCycles
(float cycles, int steps) void
setDc
(float newDc) void
setFreq
(float f) void
setPhase
(float p) void
setPhase
(float p, boolean phaseScalesTwoPi) void
setWaveColor
(int c) void
setWaveState
(net.paulhertz.pixelaudio.WaveData.WaveState newWaveState) toString()
void
updateWaveData
(float f, float a, float p, float cycles, int c, int steps) waveDataListCopy
(ArrayList<WaveData> wdList) float
waveValue
(int frame, int pos, float mapInc) float
waveValue
(int frame, int pos, float freqShift, float mapInc)
-
Field Details
-
freq
public float freqfrequency -
amp
public float ampamplitude -
phase
public float phasefraction of TWO_PI in the range 0..1, -
phaseTwoPi
public float phaseTwoPiTWO_PI * phase -
phaseCycles
public float phaseCyclesnumber of times to cycle through TWO_PI over the duration of the animation -
phaseInc
public float phaseIncincrement to the phase for each step of animation = (cycles * TWO_PI)/(animation steps) Should be set when animation begins, otherwise is set to 0, unchanging. -
dc
public float dcDC offset/bias to add to generated amplitude values, a new setting, default 0 -
waveColor
public int waveColorcolor associated with the wave -
isMuted
public boolean isMutedruntime variable for muting -
waveState
public net.paulhertz.pixelaudio.WaveData.WaveState waveStatetracking variable for mute, solo, etc. -
animSteps
public int animStepsanimation steps -
defaultAnimSteps
public static int defaultAnimStepsconvenience variable, 30 seconds of animation at 24 frames per second -
phaseScalesTwoPI
public static final boolean phaseScalesTwoPIsupport for old JSON format where phase was already scaled by TWO_PI- See Also:
-
-
Constructor Details
-
WaveData
public WaveData(float f, float a, float p, float dc, float cycles, int c, int animSteps, boolean phaseScalesTwoPi) -
WaveData
public WaveData(float f, float a, float p, float dc, float cycles, int c, int steps) Preferred constructor for WaveData- Parameters:
f
- frequencya
- amplitudep
- phase, decimal fraction of TWO_PI, typically in the range [0..1]dc
- DC component added to wave valuescycles
- number of cyles over one animation periodc
- color associated with this WaveData objectsteps
- number of frames for animation
-
WaveData
public WaveData(float f, float a, float p, float dc, float cycles, int c) Constructor for WaveData when animation steps are not known- Parameters:
f
- frequencya
- amplitudep
- phase, decimal fraction of TWO_PI, typically in the range [0..1]dc
- DC component added to wave valuescycles
- number of cyles over one animation periodc
- color associated with this WaveData objectsteps
- number of frames for animation
-
WaveData
public WaveData()
-
-
Method Details
-
updateWaveData
public void updateWaveData(float f, float a, float p, float cycles, int c, int steps) -
setFreq
public void setFreq(float f) -
setAmp
public void setAmp(float a) -
setPhase
public void setPhase(float p, boolean phaseScalesTwoPi) -
setPhase
public void setPhase(float p) -
setCycles
public void setCycles(float cycles, int steps) -
setAnimationSteps
public void setAnimationSteps(int newSteps) -
setDc
public void setDc(float newDc) -
setWaveColor
public void setWaveColor(int c) -
setWaveState
public void setWaveState(net.paulhertz.pixelaudio.WaveData.WaveState newWaveState) -
waveValue
public float waveValue(int frame, int pos, float freqShift, float mapInc) -
waveValue
public float waveValue(int frame, int pos, float mapInc) -
waveDataListCopy
-
clone
-
toString
-