public abstract class AbstractLFO extends Object implements LFO
Modifier and Type | Field and Description |
---|---|
protected boolean |
isConfigured
True if one of the set...Speed() methods has been called.
|
protected long |
randomSeed
The random seed.
|
protected SongContext |
songContext
The song context.
|
protected static double |
TWO_PI
Two times Pi.
|
Constructor and Description |
---|
AbstractLFO() |
Modifier and Type | Method and Description |
---|---|
long |
getRandomSeed()
Returns the current random seed, which is the last seed set by setRandomSeed() or the initial random seed if setRandomSeed() hasn't been called
before.
|
double |
getRawTickValue(int tick)
Returns the LFO's raw value (between 0 and 1) at the given tick, without any scaling or cut-off.
|
int |
getTickValue(int tick)
Returns the LFO's value at the given tick as an integer, taking scaling (via minAmplitude and maxAmplitude) and cut-off (via minValue and
maxValue) into account.
|
protected abstract double |
getValue(double angle)
Returns the LFO's value of the given angle as a double.
|
void |
setActivitySpeed(double rotationsPerActivity,
int startTick,
int endTick)
Makes this LFO synchronized to a tick range and sets the parameters.
|
void |
setBeatSpeed(double rotationsPerBeat,
int ticksPerBeat)
Makes this LFO synchronized to beats and sets the parameters.
|
void |
setMaxAmplitude(int maxAmplitude)
Sets the maximum value of the amplitude.
|
void |
setMaxValue(int maxValue)
Sets the maximum value to return.
|
void |
setMinAmplitude(int minAmplitude)
Sets the minimum value of the amplitude.
|
void |
setMinValue(int minValue)
Sets the minimum value to return.
|
void |
setPhase(double phase)
Set the starting phase (the phase to use for tick 0).
|
void |
setRandomSeed(long randomSeed)
Sets the random seed to use.
|
void |
setSegmentPairSpeed(double rotationsPerSegmentPair,
ActivityVector activityVector)
Makes this LFO synchronized to an ActivityVector's activity and pause segments.
|
void |
setSongContext(SongContext songContext)
Sets the song context.
|
void |
setSongSpeed(double rotationsPerSong,
int ticksPerSong)
Makes this LFO synchronized to the song length and sets the parameters.
|
void |
setTimeSpeed(double rotationsPerSecond,
int ticksPerBeat,
double bpm)
Makes this LFO synchronized to time and sets the parameters.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
configure
protected static final double TWO_PI
protected SongContext songContext
protected long randomSeed
protected boolean isConfigured
protected abstract double getValue(double angle)
angle
- the angle in radians (non-negative)public int getTickValue(int tick)
LFO
getTickValue
in interface LFO
tick
- the tick (non-negative)public double getRawTickValue(int tick)
LFO
getRawTickValue
in interface LFO
tick
- the tick (non-negative)public void setBeatSpeed(double rotationsPerBeat, int ticksPerBeat)
LFO
setBeatSpeed
in interface LFO
rotationsPerBeat
- the number of rotations per beatticksPerBeat
- the number of ticks per beatpublic void setSongSpeed(double rotationsPerSong, int ticksPerSong)
LFO
setSongSpeed
in interface LFO
rotationsPerSong
- the number of rotations for the whole songticksPerSong
- the ticks of the songpublic void setActivitySpeed(double rotationsPerActivity, int startTick, int endTick)
LFO
setActivitySpeed
in interface LFO
rotationsPerActivity
- the number of rotations for the tick rangestartTick
- the start tickendTick
- the end tickpublic void setTimeSpeed(double rotationsPerSecond, int ticksPerBeat, double bpm)
LFO
setTimeSpeed
in interface LFO
rotationsPerSecond
- the number of rotations per secondticksPerBeat
- the ticks per beatbpm
- the BPMpublic void setSegmentPairSpeed(double rotationsPerSegmentPair, ActivityVector activityVector)
LFO
setSegmentPairSpeed
in interface LFO
rotationsPerSegmentPair
- the number of rotations per segment pairactivityVector
- the activity vectorpublic void setPhase(double phase)
LFO
public void setMinValue(int minValue)
LFO
setMinValue
in interface LFO
minValue
- the value minimumpublic void setMaxValue(int maxValue)
LFO
setMaxValue
in interface LFO
maxValue
- the value maximumpublic void setMinAmplitude(int minAmplitude)
LFO
setMinAmplitude
in interface LFO
minAmplitude
- the minimum amplitude valuepublic void setMaxAmplitude(int maxAmplitude)
LFO
setMaxAmplitude
in interface LFO
maxAmplitude
- the maximum amplitude valuepublic void setRandomSeed(long randomSeed)
RandomSeedable
setRandomSeed
in interface RandomSeedable
randomSeed
- the random seedpublic long getRandomSeed()
RandomSeedable
getRandomSeed
in interface RandomSeedable
public void setSongContext(SongContext songContext)
LFO
setSongContext
in interface LFO
songContext
- the song context