at.wisch.joystick.ffeffect
Class PeriodicEffect

java.lang.Object
  extended by at.wisch.joystick.ffeffect.Effect
      extended by at.wisch.joystick.ffeffect.ExtendedEffect
          extended by at.wisch.joystick.ffeffect.PeriodicEffect
Direct Known Subclasses:
SawtoothDownEffect, SawtoothUpEffect, SineEffect, SquareEffect, TriangleEffect

public abstract class PeriodicEffect
extends ExtendedEffect

The Class PeriodicEffect. A periodic effect a wave-shaped effect that repeats itself over time. The type determines the shape of the wave and the parameters determine the dimensions of the wave: period, magnitude, offset and phase.

Author:
Martin Wischenbart

Field Summary
 
Fields inherited from class at.wisch.joystick.ffeffect.Effect
EFFECT_CONSTANT, EFFECT_CUSTOM, EFFECT_DAMPER, EFFECT_FRICTION, EFFECT_INERTIA, EFFECT_RAMP, EFFECT_SAWTOOHDOWN, EFFECT_SAWTOOTHUP, EFFECT_SINE, EFFECT_SPRING, EFFECT_SQUARE, EFFECT_TRIANGLE, INFINITE_LENGTH, MAX_DELAY, MAX_LENGTH, MAX_LEVEL, MIN_LEVEL, NO_BUTTON
 
Method Summary
 int getMagnitude()
          Gets the magnitude (the peak value of the wave).
 int getOffset()
          Gets the offset (the mean value of the wave).
 int getPeriod()
          Gets the period of the wave in ms.
 int getPhase()
          Gets the phase (the horizontal cycle shift in hundredth of a degree).
 int getStrength()
          Gets the strength.
 void setMagnitude(int magnitude)
          Sets the magnitude (the peak value of the wave).
 void setOffset(int offset)
          Sets the offset (the mean value of the wave).
 void setPeriod(int period)
          Sets the period of the wave in ms.
 void setPhase(int phase)
          Sets the phase (the horizontal cycle shift in hundredth of a degree).
 void setStrength(int strength)
          Sets the strength for an effect.
 
Methods inherited from class at.wisch.joystick.ffeffect.ExtendedEffect
getAttackLength, getAttackLevel, getDirection, getFadeLength, getFadeLevel, setAttackLength, setAttackLevel, setDirection, setFadeLength, setFadeLevel
 
Methods inherited from class at.wisch.joystick.ffeffect.Effect
getButtonIndex, getButtonInterval, getDefaultDirection, getEffectDelay, getEffectLength, getEffectType, getName, setButtonIndex, setButtonInterval, setDefaultDirection, setEffectDelay, setEffectLength
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPeriod

public int getPeriod()
Gets the period of the wave in ms.

Returns:
the period of the wave in ms

setPeriod

public void setPeriod(int period)
Sets the period of the wave in ms.

Parameters:
period - the new period of the wave in ms (value from 0 to MAX_DELAY (60000))

getMagnitude

public int getMagnitude()
Gets the magnitude (the peak value of the wave).

Returns:
the magnitude (peak value of the wave)

setMagnitude

public void setMagnitude(int magnitude)
Sets the magnitude (the peak value of the wave).

Parameters:
magnitude - the new magnitude (peak value of the wave) (value from MIN_LEVEL (-32768) to MAX_LEVEL(32767))

getOffset

public int getOffset()
Gets the offset (the mean value of the wave).

Returns:
the offset (mean value of the wave)

setOffset

public void setOffset(int offset)
Sets the offset (the mean value of the wave).

Parameters:
offset - the new offset (mean value of the wave) (value from MIN_LEVEL (-32768) to MAX_LEVEL(32767))

getPhase

public int getPhase()
Gets the phase (the horizontal cycle shift in hundredth of a degree).

Returns:
the phase (horizontal cycle shift in hundredth of a degree)

setPhase

public void setPhase(int phase)
Sets the phase (the horizontal cycle shift in hundredth of a degree).

Examples:
- 0: No phase displacement. (0 degrees)
- 9000: Displaced 25% of it's period. (90 degrees)
- 18000: Displaced 50% of it's period. (180 degrees)
- 27000: Displaced 75% of it's period. (270 degrees)

Parameters:
phase - the new phase (horizontal cycle shift in hundredth of a degree) (value from 0 to 35999)

getStrength

public int getStrength()
Gets the strength. The strength tells us about the intensity of an effect. Depending on the type of effect the strength is computed differently. If you know the type of effect, use the effect specific methods instead. Strength for a PeriodicEffect refers to the magnitude.

Specified by:
getStrength in class Effect
Returns:
the strength
See Also:
getMagnitude()

setStrength

public void setStrength(int strength)
Sets the strength for an effect. Every kind of effect has some way to set its strength or intensity. This is for convenience only, so we can use FFJoystick.getSimpleEffect() and later set strength without knowing what type of effect we actually have. If you know the type of effect, use the effect specific methods instead. Strength for a PeriodicEffect refers to the magnitude.

Specified by:
setStrength in class Effect
Parameters:
strength - the new strength (an int from 0 to MAX_LEVEL (32767))
See Also:
setMagnitude(int)