pslib
Class AudioParticle

java.lang.Object
  extended by pslib.GenericParticle
      extended by pslib.DynamicParticle
          extended by pslib.AudioParticle
All Implemented Interfaces:
PSConstants

public class AudioParticle
extends DynamicParticle

AudioParticle Class

The AudioParticle object extends the functionality of the DynamicParticle class by incorporating spatial audio calculation.

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library. If not, see http://www.gnu.org/licenses/.


Field Summary
 
Fields inherited from interface pslib.PSConstants
CAM2D_LOOK, CAM2D_RIGHT, CAM2D_UP, CORNER, INVERSE, INVERSE_TRIANGULAR, LEADING, LINEAR, MIDPOINT, NONE, STATIC, TRAILING, TRIANGULAR
 
Constructor Summary
AudioParticle()
          Create a static object instance
AudioParticle(int d)
          Create a dynamic object instance with the specified decay time
 
Method Summary
 AudioParticle copy()
          Return a copy of this particle
 float[] getRelativeAudioData(PSVector lpv, PSVector llv, PSVector luv)
          Return an array containing audio data relative to the specified listener position
 float getRelativeFBPan(PSVector lpv, PSVector llv)
          Return the front/back pan value relative to the specified listener position
 float getRelativeLRPan(PSVector lpv, PSVector llv, PSVector luv)
          Return the left/right pan value relative to the specified listener position
 float getRelativeUDPan(PSVector lpv, PSVector luv)
          Return the up/down pan value relative to the specified listener position
 float getRelativeVolume(PSVector lpv)
          Return the volume value relative to the specified listener position
 void setLimits(float min, float max)
          Set the minimum and maximum audio radii
 void setVolume(float v)
          Set the particle volume scalar
 
Methods inherited from class pslib.DynamicParticle
clearBehaviour, debug, debug, getBehaviour, getDecay, getDecayTime, getInitialDecayTime, getMass, getRenderAlpha, getRenderSize, getSnapshot, isDead, isDynamic, map, render, render, setAlphaEnvelope, setBehaviour, setBehaviour, setDecayTime, setMass, setSizeEnvelope, update
 
Methods inherited from class pslib.GenericParticle
getAlpha, getColour, getPosition, getSize, getVelocity, setAlpha, setColour, setColour, setPosition, setSize, setVelocity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioParticle

public AudioParticle()
Create a static object instance


AudioParticle

public AudioParticle(int d)
Create a dynamic object instance with the specified decay time

Parameters:
d - decay (ms)
Method Detail

setLimits

public void setLimits(float min,
                      float max)
Set the minimum and maximum audio radii

If the listener position is within the minimum radius, the particle volume will be 1, while if the listener position is outside the maxium radius, the particle volume will be 0.

Parameters:
min - minimum radius
max - maximum radius

setVolume

public void setVolume(float v)
Set the particle volume scalar

Parameters:
v - volume

getRelativeVolume

public final float getRelativeVolume(PSVector lpv)
Return the volume value relative to the specified listener position

Parameters:
lpv - listener position vector
Returns:
the volume value relative to the specified listener position

getRelativeLRPan

public final float getRelativeLRPan(PSVector lpv,
                                    PSVector llv,
                                    PSVector luv)
Return the left/right pan value relative to the specified listener position

Parameters:
lpv - listener position vector
llv - listener look vector
luv - listener up vector
Returns:
the left/right pan value relative to the specified listener position

getRelativeFBPan

public final float getRelativeFBPan(PSVector lpv,
                                    PSVector llv)
Return the front/back pan value relative to the specified listener position

Parameters:
lpv - listener position vector
llv - listener look vector
Returns:
the front/back pan value relative to the specified listener position

getRelativeUDPan

public final float getRelativeUDPan(PSVector lpv,
                                    PSVector luv)
Return the up/down pan value relative to the specified listener position

Parameters:
lpv - listener position vector
luv - listener up vector
Returns:
the up/down pan value relative to the specified listener position

getRelativeAudioData

public final float[] getRelativeAudioData(PSVector lpv,
                                          PSVector llv,
                                          PSVector luv)
Return an array containing audio data relative to the specified listener position

Format: { volume, l/r pan, f/b pan, u/d pan }

Parameters:
lpv - listener position vector
llv - listener look vector
luv - listener up vector
Returns:
an array containing audio data relative to the specified listener position

copy

public AudioParticle copy()
Return a copy of this particle

The returned copy will use the volume and limit values of the source particle and will adhere to the rules defined in the DynamicParticle map() function.

Overrides:
copy in class DynamicParticle
Returns:
a copy of this particle
See Also:
DynamicParticle