H3D API  2.4.1
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
H3D::X3DSoundSourceNode Class Reference

This abstract node type is used to derive node types that can emit audio data. More...

#include <H3D/X3DSoundSourceNode.h>

Inheritance diagram for H3D::X3DSoundSourceNode:
Inheritance graph

Classes

class  ALSoundBuffer
 Field that calls ALrender() when a field routed to it has generated an event. More...
 
class  TimeHandler
 TimeHandler is extended to stream audio data to OpenAL buffers if the sound source is a streaming source. More...
 

Public Member Functions

 X3DSoundSourceNode (Inst< SFNode > _metadata=0, Inst< SFString > _description=0, Inst< SFBool > _loop=0, Inst< SFTime > _pauseTime=0, Inst< SFFloat > _pitch=0, Inst< SFTime > _resumeTime=0, Inst< StartTime > _startTime=0, Inst< StopTime > _stopTime=0, Inst< SFTime > _duration_changed=0, Inst< SFTime > _elapsedTime=0, Inst< SFBool > _isActive=0, Inst< SFBool > _isPaused=0, Inst< TimeHandler > _timeHandler=0)
 Constructor.
 
virtual bool initALBuffers (bool stream)
 Reads new data into the OpenAL from the reader and attaches them to the sound sources that use this sound source. More...
 
virtual void ALrender ()
 Perform the OpenAL calls to render the sound.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual void registerSoundNode (X3DSoundNode *n)
 Register this sound node with the X3DSoundSourceNode. More...
 
virtual void unregisterSoundNode (X3DSoundNode *n)
 Unregister this sound node with the X3DSoundSourceNode.

 
virtual void onPause ()
 On pause, pause the sound.
 
virtual void onResume ()
 On resume, resume paused sound.
 
virtual void onStart ()
 On start, initialize AL buffers and start playing.
 
virtual void onStop ()
 On stop, stop playing the sound.
 
- Public Member Functions inherited from H3D::X3DTimeDependentNode
 X3DTimeDependentNode (Inst< SFNode > _metadata=0, Inst< SFBool > _loop=0, Inst< SFTime > _pauseTime=0, Inst< SFTime > _resumeTime=0, Inst< StartTime > _startTime=0, Inst< StopTime > _stopTime=0, Inst< SFTime > _elapsedTime=0, Inst< SFBool > _isActive=0, Inst< SFBool > _isPaused=0, Inst< TimeHandler > _timeHandler=0)
 Constructor.
 
virtual void initialize ()
 Activates the node if the conditions for a time node to be active from the start are met. More...
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual void render ()
 the render() function is used for the depth-first rendering traversal of the scene-graph. More...
 
virtual void traverseSG (TraverseInfo &ti)
 traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More...
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and the Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 

Public Attributes

H3DUniquePtr< SFStringdescription
 The description field specifies a textual description of the audio source. More...
 
H3DUniquePtr< SFFloatpitch
 The pitch field specifies a multiplier for the rate at which sampled sound is played. More...
 
H3DUniquePtr< SFTimeduration_changed
 The duration field is the length of time in seconds for one cycle of the audio for a pitch set to 1.0. More...
 
- Public Attributes inherited from H3D::X3DTimeDependentNode
H3DUniquePtr< SFBoolloop
 If loop is TRUE at the end of a cycle, execution continues into the next cycle, otherwise it stops. More...
 
H3DUniquePtr< SFTimepauseTime
 A time at which to pause and stop generating events. More...
 
H3DUniquePtr< SFTimeresumeTime
 A time at which to start generating events again after being paused. More...
 
H3DUniquePtr< StartTimestartTime
 A time-dependent node is inactive until its startTime is reached. More...
 
H3DUniquePtr< StopTimestopTime
 An active time-dependent node will become inactive when stopTime is reached if stopTime > startTime. More...
 
H3DUniquePtr< SFTimeelapsedTime
 The elapsedTime outputOnly field delivers the current elapsed time since the X3DTimeDependentNode was activated and running, cumulative in seconds and not counting any time while in a paused state. More...
 
H3DUniquePtr< SFBoolisActive
 An isActive TRUE event is generated when the node becomes active and an isActive FALSE event is generated when it becomes inactive. More...
 
H3DUniquePtr< SFBoolisPaused
 An isPaused TRUE event is generated when the node becomes paused and an isPaused FALSE event is generated when it is resumed. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DTimeDependentNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Protected Attributes

list< X3DSoundNode * > parent_sound_nodes
 The X3DSoundNodes that use this node as sound source.
 
ALuint al_buffers [NR_STREAM_BUFFERS]
 OpenAL buffer ids used for playing sound.
 
ALenum al_format
 The OpenAL format of the current sound source.
 
AutoRef< H3DSoundStreamNodereader
 The H3DSoundStreamNode used to read sound data.
 
bool sound_as_stream
 Indicates if the current sounds source is being streamed or not.
 
H3DUniquePtr< ALSoundBuffersoundBuffer
 Field that calls ALrender() when a field routed to it has generated an event.
 

Additional Inherited Members

- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 
- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

Detailed Description

This abstract node type is used to derive node types that can emit audio data.

Internal routes:

Member Function Documentation

◆ defaultXMLContainerField()

virtual string H3D::X3DSoundSourceNode::defaultXMLContainerField ( )
inlinevirtual

Returns the default xml containerField attribute value.

For this node it is "children".

Reimplemented from H3D::Node.

◆ initALBuffers()

bool X3DSoundSourceNode::initALBuffers ( bool  stream)
virtual

Reads new data into the OpenAL from the reader and attaches them to the sound sources that use this sound source.

The stream param indicates if it should init a stream source or a static source.

References al_buffers, al_format, H3D::X3DTimeDependentNode::loop, parent_sound_nodes, reader, and sound_as_stream.

Referenced by onStart().

◆ registerSoundNode()

void X3DSoundSourceNode::registerSoundNode ( X3DSoundNode n)
virtual

Register this sound node with the X3DSoundSourceNode.

All X3DSoundSourceNodes that want to play this sound source must register with this function.

References al_buffers, H3D::X3DSoundNode::getALSourceId(), H3D::X3DTimeDependentNode::loop, sound_as_stream, and soundBuffer.

Referenced by H3D::Sound::SFSoundSourceNode::onAdd().

Member Data Documentation

◆ description

H3DUniquePtr< SFString > H3D::X3DSoundSourceNode::description

The description field specifies a textual description of the audio source.

Access type: inputOutput
Default value: ""

Referenced by X3DSoundSourceNode().

◆ duration_changed

H3DUniquePtr< SFTime > H3D::X3DSoundSourceNode::duration_changed

The duration field is the length of time in seconds for one cycle of the audio for a pitch set to 1.0.

Access type: outputOnly

Referenced by X3DSoundSourceNode().

◆ pitch

H3DUniquePtr< SFFloat > H3D::X3DSoundSourceNode::pitch

The pitch field specifies a multiplier for the rate at which sampled sound is played.

Values for the pitch field shall be greater than zero.

Access type: inputOutput
Default value: 1.0

Referenced by X3DSoundSourceNode().


The documentation for this class was generated from the following files: