at.wisch.joystick.ffeffect
Class CustomEffect

java.lang.Object
  extended by at.wisch.joystick.ffeffect.Effect
      extended by at.wisch.joystick.ffeffect.ExtendedEffect
          extended by at.wisch.joystick.ffeffect.CustomEffect

Deprecated. CustomEffect is not supported for all controllers on all operating systems. Use a series of other effects instead.

@Deprecated
public class CustomEffect
extends ExtendedEffect

The Class CustomEffect. A custom force feedback effect is much like a periodic effect, where the application can define it's exact shape.

If channels is one, the effect is rotated using the defined direction. Otherwise it uses the samples in data for the different axes. In other words: If there is only a single channel, the effect is rotated in the direction specified by Direction. If there is more than one channel, rotation is not applied. Note: Not all devices support rotation of custom effects.

The first channel is applied to the first axis associated with the effect, the second to the second, and so on. If there are fewer channels than axes, nothing is associated with the extra axes. If multiple channels are provided, the data values are interleaved. For example, if channelsToUse is 3, the first element of the array belongs to the first channel, the second to the second, and the third to the third.

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
 
Constructor Summary
CustomEffect()
          Deprecated. Instantiates a new custom effect with default parameters, using 2 channels/axes.
CustomEffect(Direction direction)
          Deprecated. Instantiates a new custom effect with default parameters, using a Direction object.
CustomEffect(Direction direction, int effectLength, int effectDelay, int buttonIndex, int buttonInterval, int attackLength, int fadeLength, int attackLevel, int fadeLevel, int period, int[] data)
          Deprecated. Instantiates a new CustomEffect with the specified parameters.
CustomEffect(int effectLength, int effectDelay, int buttonIndex, int buttonInterval, int attackLength, int fadeLength, int attackLevel, int fadeLevel, int period, int channelsToUse, int[] data)
          Deprecated. Instantiates a new CustomEffect with the specified parameters.
 
Method Summary
 int getChannelsToUse()
          Deprecated. Gets the number of channels to use.
 int[] getData()
          Deprecated. Gets the data array.
 java.lang.String getName()
          Deprecated. Gets the effect type as a String.
 int getNumOfSamples()
          Deprecated. Gets the number of samples.
 int getPeriod()
          Deprecated. Gets the sample period in ms.
 int getStrength()
          Deprecated. Gets the strength.
 void setPeriod(int period)
          Deprecated. Sets the sample period in ms.
 void setSamples(int[] data)
          Deprecated. Sets the data array.
 void setSamples(int[] data, Direction dir)
          Deprecated. Sets the data array.
 void setSamples(int[] data, int channelsToUse)
          Deprecated. Sets the data array and channelsToUse.
 void setStrength(int strength)
          Deprecated. 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, setButtonIndex, setButtonInterval, setDefaultDirection, setEffectDelay, setEffectLength
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomEffect

public CustomEffect(Direction direction,
                    int effectLength,
                    int effectDelay,
                    int buttonIndex,
                    int buttonInterval,
                    int attackLength,
                    int fadeLength,
                    int attackLevel,
                    int fadeLevel,
                    int period,
                    int[] data)
Deprecated. 
Instantiates a new CustomEffect with the specified parameters. This constructor has a parameter Direction, therefore channelsToUse is not needed an will be set to 1.

Parameters:
direction - a Direction object
effectLength - the effect length in ms (or INFINITE_LENGTH)
effectDelay - the delay before the effect starts in ms
buttonIndex - the trigger button index (or NO_BUTTON)
buttonInterval - the trigger button interval in ms
attackLength - the attack length (fade-in) in ms
fadeLength - the fade length (fade-out) in ms
attackLevel - the level from where to start the fade-in
fadeLevel - the level where the fade-out fades to
period - the sample period in ms
data - the data array (array size is numOfSamples, values are from 0 to MAX_LEVEL (32767))
See Also:
CustomEffect(int, int, int, int, int, int, int, int, int, int, int[])

CustomEffect

public CustomEffect(int effectLength,
                    int effectDelay,
                    int buttonIndex,
                    int buttonInterval,
                    int attackLength,
                    int fadeLength,
                    int attackLevel,
                    int fadeLevel,
                    int period,
                    int channelsToUse,
                    int[] data)
Deprecated. 
Instantiates a new CustomEffect with the specified parameters. This constructor has a parameter channelsToUse, therefore Direction is not needed.

Parameters:
effectLength - the effect length in ms (or INFINITE_LENGTH)
effectDelay - the delay before the effect starts in ms
buttonIndex - the trigger button index (or NO_BUTTON)
buttonInterval - the trigger button interval in ms
attackLength - the attack length (fade-in) in ms
fadeLength - the fade length (fade-out) in ms
attackLevel - the level from where to start the fade-in
fadeLevel - the level where the fade-out fades to
period - the sample period in ms
channelsToUse - the number of channels/axes to use (2 or more)
data - the data array (array size is channelsToUse * numOfSamples, values are from 0 to MAX_LEVEL (32767))
See Also:
CustomEffect(Direction, int, int, int, int, int, int, int, int, int, int[])

CustomEffect

public CustomEffect()
Deprecated. 
Instantiates a new custom effect with default parameters, using 2 channels/axes.

See Also:
CustomEffect(Direction)

CustomEffect

public CustomEffect(Direction direction)
Deprecated. 
Instantiates a new custom effect with default parameters, using a Direction object.

Parameters:
direction - a Direction object
See Also:
CustomEffect()
Method Detail

getPeriod

public int getPeriod()
Deprecated. 
Gets the sample period in ms.

Returns:
the sample period in ms
See Also:
setPeriod(int)

setPeriod

public void setPeriod(int period)
Deprecated. 
Sets the sample period in ms.

Parameters:
period - the new sample period in ms (value from 0 to MAX_DELAY (60000))
See Also:
getPeriod()

getChannelsToUse

public int getChannelsToUse()
Deprecated. 
Gets the number of channels to use.

Returns:
the channels to use
See Also:
getNumOfSamples(), setSamples(int[], int)

getNumOfSamples

public int getNumOfSamples()
Deprecated. 
Gets the number of samples.

Returns:
the number of samples
See Also:
setSamples(int[], int), setSamples(int[], Direction), setSamples(int[])

getData

public int[] getData()
Deprecated. 
Gets the data array. If channelsToUse is >= 2, the values are interleaved.

Returns:
the data
See Also:
setSamples(int[], int), setSamples(int[], Direction), setSamples(int[])

setSamples

public void setSamples(int[] data,
                       int channelsToUse)
Deprecated. 
Sets the data array and channelsToUse. If channels to use is 1, the effect will be rotated using the direction. Make sure the length of the data array is an integral multiple of channelsToUse, then numOfSamples will be set automatically (data.length / channelsToUse).

Parameters:
data - the data (array size is channelsToUse * numOfSamples, values are from 0 to MAX_LEVEL (32767))
channelsToUse - the channels to use (value from 1 to 255)
See Also:
setSamples(int[], Direction), setSamples(int[]), getData(), getChannelsToUse(), getNumOfSamples()

setSamples

public void setSamples(int[] data)
Deprecated. 
Sets the data array. If you use this method, channelsToUse will be set to 1 and numOfSamples will be set to the size of the data array. The direction for the effect needs to be set separately.

Parameters:
data - the data array (values are from 0 to MAX_LEVEL (32767))
See Also:
setSamples(int[], Direction), setSamples(int[], int), getData(), ExtendedEffect.getDirection()

setSamples

public void setSamples(int[] data,
                       Direction dir)
Deprecated. 
Sets the data array. If you use this method, channelsToUse will be set to 1 and numOfSamples will be set to the size of the data array.

Parameters:
data - the data array (values are from 0 to MAX_LEVEL (32767))
dir - a Direction object
See Also:
setSamples(int[]), setSamples(int[], int), getData(), ExtendedEffect.getDirection()

getStrength

public int getStrength()
Deprecated. 
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 ConstantEffect refers to the first frame for the first axis of data (data[0]).

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

setStrength

public void setStrength(int strength)
Deprecated. 
Description copied from class: Effect
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.

Specified by:
setStrength in class Effect
Parameters:
strength - the new strength (an int from 0 to MAX_LEVEL (32767))
See Also:
Effect.getStrength(), FFJoystick.getSimpleEffect()

getName

public java.lang.String getName()
Deprecated. 
Gets the effect type as a String.

Specified by:
getName in class Effect
Returns:
the effect type as a String: "Custom"
See Also:
Effect.getEffectType()