H3D API
2.4.1
|
This abstract node type is used to derive node types that can emit audio data. More...
#include <H3D/X3DSoundSourceNode.h>
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. | |
![]() | |
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... | |
![]() | |
X3DChildNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
![]() | |
X3DNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
X3DMetadataObject * | getMetadataByName (const string &_name) |
Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More... | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (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. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
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 Field * | getField (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< SFString > | description |
The description field specifies a textual description of the audio source. More... | |
H3DUniquePtr< SFFloat > | pitch |
The pitch field specifies a multiplier for the rate at which sampled sound is played. More... | |
H3DUniquePtr< SFTime > | 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. More... | |
![]() | |
H3DUniquePtr< SFBool > | loop |
If loop is TRUE at the end of a cycle, execution continues into the next cycle, otherwise it stops. More... | |
H3DUniquePtr< SFTime > | pauseTime |
A time at which to pause and stop generating events. More... | |
H3DUniquePtr< SFTime > | resumeTime |
A time at which to start generating events again after being paused. More... | |
H3DUniquePtr< StartTime > | startTime |
A time-dependent node is inactive until its startTime is reached. More... | |
H3DUniquePtr< StopTime > | stopTime |
An active time-dependent node will become inactive when stopTime is reached if stopTime > startTime. More... | |
H3DUniquePtr< SFTime > | elapsedTime |
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< SFBool > | isActive |
An isActive TRUE event is generated when the node becomes active and an isActive FALSE event is generated when it becomes inactive. More... | |
H3DUniquePtr< SFBool > | isPaused |
An isPaused TRUE event is generated when the node becomes paused and an isPaused FALSE event is generated when it is resumed. More... | |
![]() | |
H3DUniquePtr< SFNode > | metadata |
Meta data about the node. More... | |
Static Public Attributes | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
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< H3DSoundStreamNode > | reader |
The H3DSoundStreamNode used to read sound data. | |
bool | sound_as_stream |
Indicates if the current sounds source is being streamed or not. | |
H3DUniquePtr< ALSoundBuffer > | soundBuffer |
Field that calls ALrender() when a field routed to it has generated an event. | |
Additional Inherited Members | |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
![]() | |
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. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
This abstract node type is used to derive node types that can emit audio data.
|
inlinevirtual |
Returns the default xml containerField attribute value.
For this node it is "children".
Reimplemented from H3D::Node.
|
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().
|
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().
H3DUniquePtr< SFString > H3D::X3DSoundSourceNode::description |
The description field specifies a textual description of the audio source.
Access type: inputOutput
Default value: ""
Referenced by X3DSoundSourceNode().
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().
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().