Class OGLSound
java.lang.Object
org.web3d.vrml.renderer.common.nodes.AbstractNode
org.web3d.vrml.renderer.common.nodes.sound.BaseSound
org.web3d.vrml.renderer.ogl.nodes.sound.OGLSound
- All Implemented Interfaces:
org.j3d.aviatrix3d.NodeUpdateListener
,VRMLNode
,FrameStateListener
,VRMLChildNodeType
,VRMLContentStateListener
,VRMLNodeType
,VRMLSoundNodeType
,VRMLSoundStateListener
,VRMLTimeDependentNodeType
,VRMLTimeListener
,VRMLWorldRootChildNodeType
,OGLVRMLNode
public class OGLSound
extends BaseSound
implements OGLVRMLNode, VRMLTimeListener, org.j3d.aviatrix3d.NodeUpdateListener
Sound node implementation.
- Version:
- $Revision: 1.4 $
- Author:
- Alan Hudson
-
Field Summary
Fields inherited from class org.web3d.vrml.renderer.common.nodes.sound.BaseSound
fieldDecl, fieldMap, pSource, SOURCE_NODE_MSG, SOURCE_PROTO_MSG, vfDirection, vfIntensity, vfLocation, vfMaxBack, vfMaxFront, vfMinBack, vfMinFront, vfPriority, vfSource, vfSpatialize, vrmlClock
Fields inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
errorReporter, FIELD_METADATA, fieldLocalData, hasChanged, inSetup, isDEF, isStatic, LAST_NODE_INDEX, layerIds, nodeName, pMetadata, refCounts, removedLayerIds, stateManager, STATIC_SCENE_GRAPH, vfMetadata, vrmlMajorVersion, vrmlMinorVersion
-
Constructor Summary
ConstructorsConstructorDescriptionOGLSound()
Empty constructor.OGLSound
(VRMLNodeType node) Construct a new instance of this node based on the details from the given node. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Notification that the rendering of the event model is complete and that rendering is about to begin.void
contentStateChanged
(VRMLNodeType node, int index, int state) Called when the contentState of the child audio source changes.org.j3d.aviatrix3d.SceneGraphObject
Get the Aviatrix3D scene graph object representation of this node.void
Notification that the construction phase of this node has finished.void
soundStateChanged
(VRMLNodeType node, boolean newIsActive, boolean newLoop, float newPitch, double startTime) Notification that the field from the node has changed.void
timeClick
(long time) Check on each clock tick to see if the sound has stopped playing.void
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.void
Notification that its safe to update the node now with any operations that only change the node's properties, but do not change the bounds.Methods inherited from class org.web3d.vrml.renderer.common.nodes.sound.BaseSound
copy, deleteSource, getFieldDeclaration, getFieldIndex, getFieldValue, getNodeFieldIndices, getNumFields, getPrimaryType, getSecondaryType, getSource, sendRoute, setDirection, setIntensity, setLocation, setMaxBack, setMaxFront, setMinBack, setMinFront, setPriority, setSource, setValue, setValue, setValue, setValue, setVRMLClock
Methods inherited from class org.web3d.vrml.renderer.common.nodes.AbstractNode
addNodeListener, checkNodeType, checkSecondaryType, checkSecondaryType, clearRemovedLayerIds, fireFieldChanged, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, getUserData, getVRMLNodeName, hasFieldChanged, isDEF, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, setDEF, setErrorReporter, setFrameStateManager, setMetadataObject, setUserData, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setVersion, throwInitOnlyWriteException, throwInputOnlyWriteException, throwInvalidNodeException, throwInvalidProtoException, throwOutputOnlyWriteException, updateRefCount, updateRefs
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getPrimaryType, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersion
Methods inherited from interface org.web3d.vrml.nodes.VRMLNodeType
addNodeListener, clearRemovedLayerIds, getFieldValue, getLayerIds, getMetadataObject, getRefCount, getRemovedLayerIds, hasFieldChanged, isSetupFinished, notifyExternProtoLoaded, removeNodeListener, sendRoute, setDEF, setFrameStateManager, setMetadataObject, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, updateRefCount
-
Constructor Details
-
OGLSound
public OGLSound()Empty constructor. -
OGLSound
Construct a new instance of this node based on the details from the given node. If the node is not a Sound node, an exception will be thrown. It does not copy the source node, just this node.- Parameters:
node
- The node to copy- Throws:
IllegalArgumentException
- The node is not a compatible node
-
-
Method Details
-
getSceneGraphObject
public org.j3d.aviatrix3d.SceneGraphObject getSceneGraphObject()Get the Aviatrix3D scene graph object representation of this node. This will need to be cast to the appropriate parent type when being used.- Specified by:
getSceneGraphObject
in interfaceOGLVRMLNode
- Returns:
- The OGL representation.
-
setupFinished
public void setupFinished()Notification that the construction phase of this node has finished. If the node would like to do any internal processing, such as setting up geometry, then go for it now.- Specified by:
setupFinished
in interfaceVRMLNodeType
- Overrides:
setupFinished
in classBaseSound
-
updateNodeBoundsChanges
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.- Specified by:
updateNodeBoundsChanges
in interfaceorg.j3d.aviatrix3d.NodeUpdateListener
- Parameters:
src
- The node or Node Component that is to be updated.
-
updateNodeDataChanges
Notification that its safe to update the node now with any operations that only change the node's properties, but do not change the bounds.- Specified by:
updateNodeDataChanges
in interfaceorg.j3d.aviatrix3d.NodeUpdateListener
- Parameters:
src
- The node or Node Component that is to be updated.
-
allEventsComplete
public void allEventsComplete()Notification that the rendering of the event model is complete and that rendering is about to begin. Used to update the transformation matrix only once per frame.- Specified by:
allEventsComplete
in interfaceFrameStateListener
- Overrides:
allEventsComplete
in classAbstractNode
-
contentStateChanged
Description copied from class:BaseSound
Called when the contentState of the child audio source changes. The base implementation does nothing. Subclasses can trap this call to determine when the audio source is available for use (when state==LOAD_COMPLETE).- Specified by:
contentStateChanged
in interfaceVRMLContentStateListener
- Overrides:
contentStateChanged
in classBaseSound
- Parameters:
node
- The child sound source node.index
- The index of the field that has changed state.state
- The new state value.
-
soundStateChanged
public void soundStateChanged(VRMLNodeType node, boolean newIsActive, boolean newLoop, float newPitch, double startTime) Notification that the field from the node has changed.- Specified by:
soundStateChanged
in interfaceVRMLSoundStateListener
- Overrides:
soundStateChanged
in classBaseSound
- Parameters:
node
- The component node that changednewIsActive
- The current value of the isActive fieldnewLoop
- The current value of the loop fieldnewPitch
- The current value of the pitch fieldstartTime
-
-
timeClick
public void timeClick(long time) Check on each clock tick to see if the sound has stopped playing. If it has, we must either restart it (if loop is true) or tell the sound source that it has finished by calling setIsActive(false)- Specified by:
timeClick
in interfaceVRMLTimeListener
- Parameters:
time
- Current time
-