org.xith3d.scenegraph
Class Sound

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
All Implemented Interfaces:
org.jagatoo.datatypes.Enableable, org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode
Direct Known Subclasses:
BackgroundSound, PointSound

public abstract class Sound
extends Leaf
implements org.jagatoo.datatypes.Enableable

Base for all Sound Nodes to be placed into the scenegraph.


Field Summary
static int DURATION_UNKNOWN
           
static int INFINITE_LOOPS
           
static float 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
Sound(SoundContainer soundContainer)
           
Sound(SoundContainer soundContainer, float gain)
           
 
Method Summary
 void freeOpenGLResources(CanvasPeer canvasPeer)
          This method frees OpenGL resources (names) for all Nodes in the traversal of this Node(-Group).
 long getDuration()
           
 float getInitialGain()
           
 int getLoopType()
           
 float getPriority()
           
 org.openmali.spatial.bounds.Bounds getRegion()
           
 BoundingLeaf getSchedulingBoundingLeaf()
           
 org.openmali.spatial.bounds.Bounds getSchedulingBounds()
           
 SingletonSoundContainer getSingletonSoundContainer()
           
 SoundContainer getSoundContainer()
           
 long getSoundPosition()
           
 SoundSource getSource()
           
 boolean isContinuousEnabled()
           
 boolean isDisabled()
           
 boolean isEnabled()
           
 boolean isPaused()
           
 boolean isPlaying()
           
 boolean isReady()
           
 boolean isReady(View view)
           
 boolean isReleaseEnabled()
           
 void play()
           
 void setContinuousEnabled(boolean continuousEnabled)
           
 void setDeactivated(boolean val)
          Never use this method on your own!
 void setDisabled(boolean disabled)
           
 void setEnabled(boolean enabled)
          Enables or disables this Sound Node.
 void setInitialGain(float initialGain)
           
protected  boolean setLive(boolean live)
          If making node non-live when it was live deallocates sound resources associated with this sound node, and marks this node as non-enabled by call to setEnable(false).
 void setLoopType(int loopType)
           
 void setPaused(boolean paused)
          Pauses or resumes this Sound Node.
 void setPriority(float priority)
           
 void setRegion(org.openmali.spatial.bounds.Bounds region)
           
 void setReleaseEnabled(boolean releaseEnable)
           
 void setRestarted(boolean val)
          Never use this method on your own!
 void setSchedulingBoundingLeaf(BoundingLeaf boundingLeaf)
           
 void setSchedulingBounds(org.openmali.spatial.bounds.Bounds bounds)
           
 void setSource(SoundSource source)
          Should be set only by the View
 boolean traverse(DetailedTraversalCallback callback)
          Traverses the scenegraph from this node on.
 boolean wasDeactivated()
          Never use this method on your own!
 boolean wasRestarted()
          Never use this method on your own!
 
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
 

Field Detail

NO_FILTER

public static final float NO_FILTER
See Also:
Constant Field Values

DURATION_UNKNOWN

public static final int DURATION_UNKNOWN
See Also:
Constant Field Values

INFINITE_LOOPS

public static final int INFINITE_LOOPS
See Also:
Constant Field Values
Constructor Detail

Sound

public Sound(SoundContainer soundContainer,
             float gain)

Sound

public Sound(SoundContainer soundContainer)
Method Detail

setSource

public void setSource(SoundSource source)
Should be set only by the View

Parameters:
source -

getSource

public final SoundSource getSource()
Returns:
the current sound source supporting the sound. This is here mostly to support the View, but it can be used if done carefully to manipulate the sound source explcitely. This can return null if the sound is not active.

setDisabled

public void setDisabled(boolean disabled)

isDisabled

public final boolean isDisabled()

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this Sound Node.

Specified by:
setEnabled in interface org.jagatoo.datatypes.Enableable
Parameters:
enabled -

isEnabled

public final boolean isEnabled()
Specified by:
isEnabled in interface org.jagatoo.datatypes.Enableable

setRestarted

public void setRestarted(boolean val)
Never use this method on your own! It's just for internal use.


wasRestarted

public final boolean wasRestarted()
Never use this method on your own! It's just for internal use.


setDeactivated

public void setDeactivated(boolean val)
Never use this method on your own! It's just for internal use.


wasDeactivated

public final boolean wasDeactivated()
Never use this method on your own! It's just for internal use.


getSoundContainer

public final SoundContainer getSoundContainer()

getSingletonSoundContainer

public final SingletonSoundContainer getSingletonSoundContainer()

setInitialGain

public void setInitialGain(float initialGain)

getInitialGain

public final float getInitialGain()

setPriority

public void setPriority(float priority)

getPriority

public final float getPriority()

setRegion

public void setRegion(org.openmali.spatial.bounds.Bounds region)

getRegion

public final org.openmali.spatial.bounds.Bounds getRegion()

play

public void play()

setLoopType

public void setLoopType(int loopType)

getLoopType

public final int getLoopType()

setReleaseEnabled

public void setReleaseEnabled(boolean releaseEnable)

isReleaseEnabled

public final boolean isReleaseEnabled()

setContinuousEnabled

public void setContinuousEnabled(boolean continuousEnabled)

isContinuousEnabled

public final boolean isContinuousEnabled()

setSchedulingBounds

public void setSchedulingBounds(org.openmali.spatial.bounds.Bounds bounds)
Parameters:
bounds -

getSchedulingBounds

public final org.openmali.spatial.bounds.Bounds getSchedulingBounds()

setSchedulingBoundingLeaf

public void setSchedulingBoundingLeaf(BoundingLeaf boundingLeaf)
Parameters:
boundingLeaf -

getSchedulingBoundingLeaf

public final BoundingLeaf getSchedulingBoundingLeaf()

getDuration

public final long getDuration()

isReady

public final boolean isReady()

isReady

public final boolean isReady(View view)
Parameters:
view -
Returns:

isPlaying

public final boolean isPlaying()

setPaused

public void setPaused(boolean paused)
Pauses or resumes this Sound Node.

Parameters:
paused -

isPaused

public final boolean isPaused()
Returns:
true, if the Sound Node has been paused

setLive

protected boolean setLive(boolean live)
If making node non-live when it was live deallocates sound resources associated with this sound node, and marks this node as non-enabled by call to setEnable(false).

Overrides:
setLive in class SceneGraphObject
Returns:
true, if the state has changed

getSoundPosition

public final long getSoundPosition()
Returns:
the position in the sound, in milli-seconds

freeOpenGLResources

public void freeOpenGLResources(CanvasPeer canvasPeer)
This method frees OpenGL resources (names) for all Nodes in the traversal of this Node(-Group).

Specified by:
freeOpenGLResources in class Node

traverse

public boolean traverse(DetailedTraversalCallback callback)
Traverses the scenegraph from this node on. If this Node is a Group it will recusively run through each child.

Overrides:
traverse in class Leaf
Parameters:
callback - the listener is notified of any traversed Node on the way
Returns:
if false, the whole traversal will stop