org.xith3d.scenegraph
Class PointSound

java.lang.Object
  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.Leaf
              extended by org.xith3d.scenegraph.Sound
                  extended by org.xith3d.scenegraph.PointSound
All Implemented Interfaces:
org.jagatoo.datatypes.Enableable, org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode

public class PointSound
extends Sound

PointSounds are those sounds which exist in the point in space within the transform groups it exists. It is assumed that the sound exists within its local coordinate system at (0, 0, 0).

PointSounds have their volume attenuated based on an inverse distance formula which is acoustically similar to that of the human ear. This is not linear, but rather logarithmic in nature.


Field Summary
 
Fields inherited from class org.xith3d.scenegraph.Sound
DURATION_UNKNOWN, INFINITE_LOOPS, NO_FILTER
 
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
 
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
XITH3D_USERDATAKEY_OLDUSERDATA
 
Constructor Summary
PointSound(SoundContainer soundContainer)
           
PointSound(SoundContainer soundContainer, float gain)
           
 
Method Summary
 float getMaxDistance()
           
 float getMaxVolume()
           
 float getMinVolume()
           
 float getReferenceDistance()
          The reference distance is the distance from the view that the sound will become at maximum volume.
 float getRolloffFactor()
          The rollover-factor compresses or expands the range this sound can be heard. 0 will make the sound unattenuated (uneffected by distance). 1 is the normal setting. 0.5 will make the sound appear to be twice as close as it really is, while 2 will make it sound twice as far away as it really is.
 void setMaxDistance(float maxDistance)
          Sets the max distance before the sound is a min volume.
 void setMaxVolume(float maxVolume)
          Sets the max volume for this sound.
 void setMinVolume(float minVolume)
          Sets the minimum volume, even at max distance.
 void setReferenceDistance(float referenceDistance)
          The reference distance is the distance from the view that the sound will become at maximum volume.
 void setRolloffFactor(float rolloffFactor)
          The rollover-factor compresses or expands the range this sound can be heard. 0 will make the sound unattenuated (uneffected by distance). 1 is the normal setting. 0.5 will make the sound appear to be twice as close as it really is, while 2 will make it sound twice as far away as it really is.
 
Methods inherited from class org.xith3d.scenegraph.Sound
freeOpenGLResources, getDuration, getInitialGain, getLoopType, getPriority, getRegion, getSchedulingBoundingLeaf, getSchedulingBounds, getSingletonSoundContainer, getSoundContainer, getSoundPosition, getSource, isContinuousEnabled, isDisabled, isEnabled, isPaused, isPlaying, isReady, isReady, isReleaseEnabled, play, setContinuousEnabled, setDeactivated, setDisabled, setEnabled, setInitialGain, setLive, setLoopType, setPaused, setPriority, setRegion, setReleaseEnabled, setRestarted, setSchedulingBoundingLeaf, setSchedulingBounds, setSource, traverse, wasDeactivated, wasRestarted
 
Methods inherited from class org.xith3d.scenegraph.Leaf
dump, getPickHost, setPickHost
 
Methods inherited from class org.xith3d.scenegraph.Node
absorbDetails, cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBounds, setBoundsAutoCompute, setBoundsDirty, setBoundsDirtyUpward, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setModListener, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, sharedCopy, sharedCopy, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateBounds, updateBoundsCheap, updateOrderedChild, updateTransformGroup, updateWorldTransform
 
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PointSound

public PointSound(SoundContainer soundContainer,
                  float gain)

PointSound

public PointSound(SoundContainer soundContainer)
Method Detail

setMinVolume

public void setMinVolume(float minVolume)
Sets the minimum volume, even at max distance.

Parameters:
minVolume -

getMinVolume

public final float getMinVolume()
Returns:
the minimum volume for this sournd, even at max distance

setMaxVolume

public void setMaxVolume(float maxVolume)
Sets the max volume for this sound.

Parameters:
maxVolume -

getMaxVolume

public final float getMaxVolume()
Returns:
the maximum volume of this sound

setMaxDistance

public void setMaxDistance(float maxDistance)
Sets the max distance before the sound is a min volume. If this is set to -1 then the View's sound activation radius will be used.

Parameters:
maxDistance -

getMaxDistance

public final float getMaxDistance()
Returns:
the max distance before this sound is at min volume

setRolloffFactor

public void setRolloffFactor(float rolloffFactor)
The rollover-factor compresses or expands the range this sound can be heard. 0 will make the sound unattenuated (uneffected by distance). 1 is the normal setting. 0.5 will make the sound appear to be twice as close as it really is, while 2 will make it sound twice as far away as it really is.


getRolloffFactor

public final float getRolloffFactor()
The rollover-factor compresses or expands the range this sound can be heard. 0 will make the sound unattenuated (uneffected by distance). 1 is the normal setting. 0.5 will make the sound appear to be twice as close as it really is, while 2 will make it sound twice as far away as it really is.

Returns:
the current rollover-factor

setReferenceDistance

public void setReferenceDistance(float referenceDistance)
The reference distance is the distance from the view that the sound will become at maximum volume. This is usually good to set within a few units of the view so that you don't have scaling in the last few units. If the reference distance is -1 then the 0.17 of the max distance will be used.


getReferenceDistance

public final float getReferenceDistance()
The reference distance is the distance from the view that the sound will become at maximum volume. This is usually good to set within a few units of the view so that you don't have scaling in the last few units.

Returns:
the current reference-distance