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, vrmlClockFields 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 TypeMethodDescriptionvoidNotification that the rendering of the event model is complete and that rendering is about to begin.voidcontentStateChanged(VRMLNodeType node, int index, int state) Called when the contentState of the child audio source changes.org.j3d.aviatrix3d.SceneGraphObjectGet the Aviatrix3D scene graph object representation of this node.voidNotification that the construction phase of this node has finished.voidsoundStateChanged(VRMLNodeType node, boolean newIsActive, boolean newLoop, float newPitch, double startTime) Notification that the field from the node has changed.voidtimeClick(long time) Check on each clock tick to see if the sound has stopped playing.voidNotification that its safe to update the node now with any operations that could potentially effect the node's bounds.voidNotification 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, setVRMLClockMethods 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, updateRefsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.web3d.vrml.lang.VRMLNode
getFieldDeclaration, getFieldIndex, getNodeFieldIndices, getNumFields, getPrimaryType, getSecondaryType, getUserData, getVRMLNodeName, isDEF, setErrorReporter, setUserData, setVersionMethods 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:
getSceneGraphObjectin 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:
setupFinishedin interfaceVRMLNodeType- Overrides:
setupFinishedin classBaseSound
-
updateNodeBoundsChanges
Notification that its safe to update the node now with any operations that could potentially effect the node's bounds.- Specified by:
updateNodeBoundsChangesin 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:
updateNodeDataChangesin 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:
allEventsCompletein interfaceFrameStateListener- Overrides:
allEventsCompletein classAbstractNode
-
contentStateChanged
Description copied from class:BaseSoundCalled 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:
contentStateChangedin interfaceVRMLContentStateListener- Overrides:
contentStateChangedin 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:
soundStateChangedin interfaceVRMLSoundStateListener- Overrides:
soundStateChangedin 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:
timeClickin interfaceVRMLTimeListener- Parameters:
time- Current time
-